-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
The Problem
I've been having an ongoing discussion with @bmeck and a few folks working on the V8 project (@schuay, @fhinkel) about how to move istanbul towards using v8's built-in coverage.
The biggest blocker, tracked in the v8 issue tracker here, is that we need a way to start Node with detailed coverage enabled. -- @schuay can speak better to the specifics, but as I understand it code needs to be put through a preprocessing step that introduces counters, currently we're only able to collect function-level coverage.
There are a few other blockers that I will also outline in this issue.
Collecting Detailed Coverage
- @schuay proposes introducing a v8 flag that could be passed to Node when starting, and would run inspector with detailed reporting enabled; does this mean that we'd need to stat Node.js with
--inspectoror could we still enable this post-hoc?
Other Challenges
There are a few other technical challenges that will need to be addressed, to make the switch over to v8's test coverage:
- if an application exits using
process.exitor by throwing an exception, it's hard to capture this event and output the coverage information (since talking to the inspector's socket is asynchronous); One option might be usingspawnSyncwithinprocess.exit(), but this currently has bugs. - v8's coverage output is significantly different than Itanbul's coverage.json format we'll need to write something that translates between the formats.
Why this is super cool
- transpilation to add coverage counters is complex and error-prone, it would be neat to have this happen at the v8 level.
- code transpiled for test coverage runs significantly slower than the code prior to transpilation; I'm betting collecting coverage directly from v8 will be fast (although the subprocess shenanigans might add some overhead).
- this would give us a way to collect coverage for
.mjsmodule files, which is currently not possible since the new module system does not executerequire.extensions.
jasnell, schuay and joyeecheung
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.