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.

[feature request] call afterAll() on `ctrl+c`

See original GitHub issue

Do you want to request a feature or report a bug?

What is the current behavior?

When I launch a test taking way too long to run, I hit ctrl+c to stop it. But… then afterAll method is not called (to clean what I have done in beforeAll).

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

I wish afterAll was called when typing ctrl+c

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
peterjurascommented, Feb 25, 2018

It would be nice if globalTeardown would also be run.

1reaction
rickhanloniicommented, May 5, 2020

Thanks @seanpoulter - it sounds like crtl+c has hooks into the subprocesses so they’re killed but when you only kill the parent jest process we don’t forward the kill to children. I would have expected Node to handle that but I guess they don’t. That’s a bug we should fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detecting CTRL+C in Node.js - Stack Overflow
So basically, all you need to do is: process.on('SIGINT', () => {}); // CTRL+C process.on('SIGQUIT', () => {}); // Keyboard quit ...
Read more >
66583: Ctrl-C behavior violates principle of least astonishment
The request is to behave like a shell: % mysql -D test mysql> mysql> SELECT foo, ^C mysql> mysql> SELECT * FROM really_really_big_table;...
Read more >
519233 – Pressing Ctrl-C while yum downloads something ...
Anyway, in Rawhide now, Ctrl-C handling in yum is still broken: Ctrl-C once doesn't do anything immediately. After 10-20 seconds it prints: Current...
Read more >
Introduction To Unix Signals Programming
Ctrl -C: Pressing this key causes the system to send an INT signal ( SIGINT ) to ... It first sends a TERM...
Read more >
Undo, redo, and other shortcut key functions - Progress Software
You can use Redo command only after Undo command. Select all. CTRL+A, To perform a function on all the content in the text...
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