Skip to content

[BUG] Tests crash out on ctrl-c #6766

Open
@rotu

Description

@rotu

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Interrupting tests with ctrl-c results in an error:

TypeError: The "code" argument must be of type number. Received type string ('128SIGINT')
at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
at ChildProcess. (/Users/dan/Source/npm-cli/node_modules/nyc/node_modules/foreground-child/index.js:63:22)
at ChildProcess.emit (node:events:514:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1105:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)

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

  1. In Mac or Windows
  2. Run npm test
  3. Use ctrl-c to abort the tests
  4. Observe error

Environment

  • npm: 10.0.0
  • Node.js: 20.6.0
  • OS Name: macOS
  • System Model Name: Macbook Air
  • npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc

prefix = "/opt/homebrew" 

; "user" config from /Users/dan/.npmrc

auto-install-peers = true 

; "project" config from /Users/dan/Source/npm-cli/.npmrc

package-lock = true 

; node bin location = /opt/homebrew/Cellar/node/20.6.0/bin/node
; node version = v20.6.0
; npm local prefix = /Users/dan/Source/npm-cli
; npm version = 9.8.1
; cwd = /Users/dan/Source/npm-cli
; HOME = /Users/dan
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 10.xRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions