You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using jest to test my node server code. As I make changes to the code I run the tests. If there is a syntax error in my code jest helpfully points me to the line. The problem is that when there is a syntax error, jest invokes beforeAll but not afterAll. I'm using beforeAll to create a database and set up mocks, and afterAll to drop this database, so when there are syntax errors and afterAll is not invoked, it leaves around databases that I then have to clean up manually.
I'd like jest to always either
not invoke either beforeAll or afterAll
invoke both beforeAll or afterAll
The text was updated successfully, but these errors were encountered:
After doing further testing I've identified the root cause, which is that when beforeAll throws an exception or returns a promise that rejects, the tests are still run. I've opened an issue here: #2713
I am using jest to test my node server code. As I make changes to the code I run the tests. If there is a syntax error in my code jest helpfully points me to the line. The problem is that when there is a syntax error, jest invokes
beforeAll
but notafterAll
. I'm usingbeforeAll
to create a database and set up mocks, andafterAll
to drop this database, so when there are syntax errors andafterAll
is not invoked, it leaves around databases that I then have to clean up manually.I'd like jest to always either
beforeAll
orafterAll
beforeAll
orafterAll
The text was updated successfully, but these errors were encountered: