-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Tests crash out on ctrl-c #6766
Comments
FYI, @lukekarrys. I wonder if whatever necessitated b8a5764 is related to this issue. |
I haven't looked into this too deeply yet, but I believe this is due to a change in Node 20 of new restrictions on |
Ah. Can confirm this happens on my machine in Node 20 but not Node 18. Node 19 gives a deprecation warning: (node:38601) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated. at process.set [as exitCode] (node:internal/bootstrap/node:118:9) at ChildProcess. (/Users/dan/Source/npm-cli/node_modules/nyc/node_modules/foreground-child/index.js:63:22) at ChildProcess.emit (node:events:513:28) at ChildProcess.emit (node:domain:489:12) at maybeClose (node:internal/child_process:1098:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) |
@lukekarrys Actually, you may want to bump up the priority. Further experimentation shows that, in Node 18, the process actually exits with exit code 0. This could very well be causing tests that should fail to accidentally pass! node -e 'process.exitCode=42; process.exit()'; echo $?
# 42
node -e 'process.exitCode=42+"SIGINT"; process.exit()'; echo $?
# 0 |
FYI @isaacs, this seems important to your work on tapjs. |
I already have much more sophisticated signal and error handling code in tap 18. Unfortunately, I'm a bit delayed in shipping it, because the changes to the loader system in node have required quite a lot of work to get everything converted over. The mockImport method is almost done being converted, and I'm waiting on https://github.com/TypeStrong/ts-node/pulls/2009 to land for ts-node to work there. Once those are done, I can ship tap 18, and ignore this and all NYC errors forever 😅 Can you get it to happen in foreground-child v3? If not, I'm inclined to say it's just |
Omg, I just looked at the link you posted. Adding 128 to the signal byte to get it to exit properly. Those were the ""good"" old days, for sure. |
Awesome! I didn't know you were ditching It's also good that this doesn't fail so quietly on Node 20. Why it ever failed silently makes me fear for humanity a little bit.
Heh. It seems like the |
Kids these days thinking node 0.10 was the first node version, get off my lawn etc. Yeah, istr that is copy-pasta from an
You and me both. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Interrupting tests with ctrl-c results in an error:
This seems to come from bad logic adding a number to a string in
[email protected]
(outdated) via[email protected]
(latest, but unmaintained).Expected Behavior
Tests should exit cleanly.
Steps To Reproduce
npm test
Environment
The text was updated successfully, but these errors were encountered: