istanbuljs / nyc

the Istanbul command line interface

Home Page:https://istanbul.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clears Code Coverage Data and Resets Coverage Context When Child Processes Are Created

ShivaPotlapelli opened this issue · comments

Issue Description:
When running a Node.js server script with NYC (New York City) for code coverage, the coverage data is not accumulating as expected. Instead, NYC clears the previously generated coverage data and sets a new coverage context each time a child process is created. This behavior results in the loss of cumulative coverage data, making it challenging to obtain a complete code coverage report when the server script involves child processes.

Expected Behavior:
The expected behavior is that NYC should preserve the accumulated coverage data when child processes are created. This means that the coverage context should not be reset for each child process, allowing for the accurate accumulation of code coverage across the entire execution of the server script.

Observed Behavior:
The observed behavior is that NYC, specifically in version 15.1.0, clears the previously generated coverage data and sets a new coverage context when child processes are created. This behavior can hinder the ability to obtain a comprehensive code coverage report, as coverage data is not preserved across child process boundaries.

Troubleshooting Steps:

  • The issue persists even after attempting to disable coverage caching by adding cache: false in the NYC configuration.

Environment Information:

  • NYC version: 15.1.0