jest: [Bug]: afterAll() and afterEach() hooks are not invoked when Jest CLI exits because of SIGINT

Version

27.4.7

Steps to reproduce

  1. Clone https://github.com/cowboyd/jest-suite-hooks-on-sigint
  2. yarn install
  3. yarn test
  4. 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 40

Most upvoted comments

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

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 30 days.

raccoon noises

boop

👍🏻

Thank you for keeping this issue active, I just encountered it personally.

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.