question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:20

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, Feb 25, 2022

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.

0reactions
RileyMuellercommented, Dec 8, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found