Don't force-exit after tests have completed#3260
Conversation
The assertion message is different, which requires more creativity with the snapshots.
|
This is a non trivial breaking change. We relied heavily on the feature of ava where we didnt have to tear down any database connections etc and it would kill the process when the tests are done. |
|
Unfortunately it caused hard to understand errors in Node where it wouldn't exit at all. Can you close these in an after hook? If that is problematic due to the restrictions on test declarations we could come up with another mechanism, say an event when it's safe to force the exit? |
|
I'm facing with this too – It seems to me a mechanism should be provided in order to be possible to achieve this in a explicit way (see #3259 (comment)) |
I fully understand that is the case, this is why i've written or used other test frameworks that don't autoclose. Going from autoclose to not autoclose is such a large breaking change you might as well switch test frameworks. In fact it's probably cheaper and quicker for me to port the tests to |
|
@Raynos @Kikobeats I think a Other use cases are as a cleanup routine that sits outside of AVA's test & hook logic. I'm leaning to a solution like this over configuration because configuration implies we can handle edge cases in Node.js and we can't. |
closes: #9083 ## Description Breaking changes in v6: https://github.com/avajs/ava/releases/tag/v6.0.0 Relevant subset: - When tests finish, worker threads or child processes are no longer exited through proces.exit(). If your test file does not exit on its own, the test run will time out. avajs/ava#3260 - Failed assertions now throw, meaning that any subsequent code is not executed. This also impacts the type definitions. avajs/ava#3246 - [Only native errors](https://nodejs.org/api/util.html#utiltypesisnativeerrorvalue) are now considered errors by the t.throws() and t.throwsAsync() assertions. [Object.create(Error.prototype) is not a native error](https://github.com/avajs/ava/blob/v6.0.0/Object.create(Error.prototype)). avajs/ava#3229 This removes our local patches of Ava - #7619 - #7330 ### Security Considerations none, no runtime change ### Scaling Considerations none, no runtime change ### Documentation Considerations none ### Testing Considerations CI ### Upgrade Considerations none, no runtime change
Fixes #1718.
With worker threads, this seems to stop AVA from detecting that the thread has exited, causing a hang.
Also remove flush logic implemented in #1722. Let's hope that current Node.js versions are better at flushing IPC before exiting.
To do: add a testChange is mainly visible in reporters which don't have great tests