Comments (5)
Oh I see. That's a good catch @arszh
Not sure how I feel about that gist workaround, doesn't seem friendly. What if we just refactor the test a bit so that the expect is simply not inside a try/catch?
from typeform-export-excel.
We can declare actual
and expected
variables before try/catch and move down expect(expected.size).toEqual(actual.size)
under try/catch, but I think it is not good.
In my opinion, maybe I wrong, we can delete the try/catch altogether because:
- It prevents find errors and situations where exceptions are raised.
- Test doesn't check receiving certain exceptions.
- 'Catch' doesn't improve information from caught exception to output it.
If important to remove created file after this test:
- It will be deleted anyway when developer fix fail and the test is passed.
- Can use
afterAll()
to remove all created excel files after all tests.
from typeform-export-excel.
this is the test we're referring to, right?
try {
// eslint-disable-next-line
const actual = fs.statSync(path.resolve('./__tests__/Fixtures/sample.xlsx'))
// eslint-disable-next-line
const expected = fs.statSync(path.resolve(testOutputFilename))
expect(expected.size).toEqual(actual.size)
} catch (e) {
} finally {
// eslint-disable-next-line
fs.unlinkSync(testOutputFilename)
}
in which case, the expectation is within a try/catch only for the sake of cleaning-up. In this case, how about we simply clean up in a Jest's afterAll() hook? Surely it's not as clean as with doing this within every test, but for the sake of this small lib seems not far fetched.
Looks like you are suggesting the same so
from typeform-export-excel.
fixed in #18
from typeform-export-excel.
@arszh @lirantal Can you guys please suggest what should be fixed for below case, It is always passing :
test("test", () => {
try {
expect(true).toBe(false);
} catch (err) {
console.log(err);
}
});
from typeform-export-excel.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeform-export-excel.