Skip to content

Zero coverage reported after SIGKILL #1592

@mayant15

Description

@mayant15

I have a script that blocks the event loop and is run with a timeout:

// in loop.js
while(true) {}
$ timeout -s KILL 2s node loop.js

nyc reports zero coverage when the node process is killed, when in this case it should be 100%.

$ npx nyc timeout -s KILL 2s node loop.js
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |
----------|---------|----------|---------|---------|-------------------

Also noticed that if sending a SIGTERM as timeout does by default, the node process doesn't terminate.

$ timeout 2s node loop.js # this terminates
$ npx nyc timeout 2s node loop.js # this doesn't terminate

Version Info

  • nyc 17.1.0
  • node 22.12.0
  • npx 11.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions