[Bug]: afterAll() and afterEach() hooks are not invoked when Jest CLI exits because of SIGINT
See original GitHub issueVersion
27.4.7
Steps to reproduce
- Clone https://github.com/cowboyd/jest-suite-hooks-on-sigint
- yarn install
- yarn test
- Hit Ctrl-C
afterAll()
and afterEach()
hooks are not invoked.
Expected behavior
I expect to see afterEach.txt
and afterAllt.xt
files written to the file system with the content “ok”.
Actual behavior
No files are created.
Additional context
https://github.com/facebook/jest/issues/10927
Environment
System:
OS: macOS 12.1
CPU: (8) arm64 Apple M1
Binaries:
Node: 16.13.0 - ~/.volta/tools/image/node/16.13.0/bin/node
Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
npm: 8.3.0 - ~/.volta/tools/image/npm/8.3.0/bin/npm
npmPackages:
jest: ^27.4.7 => 27.4.7
Issue Analytics
- State:
- Created 2 years ago
- Comments:20
Top Results From Across the Web
Connecting and disconnecting (Concepts) - Prisma
This page explains how database connections are handled with Prisma Client and how to manually connect and disconnect your database.
Read more >Hooks - Fastify
Hooks. Hooks are registered with the fastify.addHook method and allow you to listen to specific events in the application or request/response lifecycle.
Read more >pytest Documentation - Read the Docs
Note: Calling pytest.main() will result in importing your tests and any ... Key error expected because a config is not passed, and the....
Read more >Behavior-Driven Development | Manual - Deno
The afterEach and afterAll hooks will be called whether or not the test case passes. ... cause the process to exit, for example...
Read more >Node.js v19.3.0 Documentation
If the function has not been called exactly exact times when tracker.verify() is called, then tracker.verify() will throw an error. import assert from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Thank you for keeping this issue active, I just encountered it personally.