process: refactor coverage setup during bootstrap#25398
process: refactor coverage setup during bootstrap#25398joyeecheung wants to merge 2 commits intonodejs:masterfrom
Conversation
- Renamed `internal/process/write-coverage.js` to
`internal/coverage-gen/with_instrumentation.js`,
`internal/process/coverage.js` to
`internal/coverage-gen/with_profiler.js` to distinguish
the two better and added comments.
- Separate the coverage directory setup and the connection
setup, moves the directory setup into `node.js` and
closer to the exit hooks because that's where it's used.
- Moves the `process.reallyExit` overwrite and
`process.on('exit')` hooks setup into bootstrap/node.js
for clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
|
@joyeecheung one comment, if we can prove out that #25157 is working, we should be able to get rid of I'd also love to make sure that we run a full coverage report with this refactor before we land, to make sure coverage continues to be enabled early enough to collect data for key internal libraries. |
| // Core coverage generation using nyc instrumented lib/ files: | ||
| // see `make coverage-build`. | ||
| // This does not affect user land. | ||
| if (global.__coverage__) { |
There was a problem hiding this comment.
similarly, we should soon be in a position to drop this code. CC: @mhdawson
There was a problem hiding this comment.
Until that actually happens, I guess a TODO would be enough?
|
@bcoe @cjihrig Thanks for the reviews, updated. Also a screenshot from a local run of |
|
Landed in b367ab2 |
- Renamed `internal/process/write-coverage.js` to
`internal/coverage-gen/with_instrumentation.js`,
`internal/process/coverage.js` to
`internal/coverage-gen/with_profiler.js` to distinguish
the two better and added comments.
- Separate the coverage directory setup and the connection
setup, moves the directory setup into `node.js` and
closer to the exit hooks because that's where it's used.
- Moves the `process.reallyExit` overwrite and
`process.on('exit')` hooks setup into bootstrap/node.js
for clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
PR-URL: #25398
Reviewed-By: Ben Coe <[email protected]>
- Renamed `internal/process/write-coverage.js` to
`internal/coverage-gen/with_instrumentation.js`,
`internal/process/coverage.js` to
`internal/coverage-gen/with_profiler.js` to distinguish
the two better and added comments.
- Separate the coverage directory setup and the connection
setup, moves the directory setup into `node.js` and
closer to the exit hooks because that's where it's used.
- Moves the `process.reallyExit` overwrite and
`process.on('exit')` hooks setup into bootstrap/node.js
for clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
PR-URL: #25398
Reviewed-By: Ben Coe <[email protected]>
- Renamed `internal/process/write-coverage.js` to
`internal/coverage-gen/with_instrumentation.js`,
`internal/process/coverage.js` to
`internal/coverage-gen/with_profiler.js` to distinguish
the two better and added comments.
- Separate the coverage directory setup and the connection
setup, moves the directory setup into `node.js` and
closer to the exit hooks because that's where it's used.
- Moves the `process.reallyExit` overwrite and
`process.on('exit')` hooks setup into bootstrap/node.js
for clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
PR-URL: nodejs#25398
Reviewed-By: Ben Coe <[email protected]>
- Renamed `internal/process/write-coverage.js` to
`internal/coverage-gen/with_instrumentation.js`,
`internal/process/coverage.js` to
`internal/coverage-gen/with_profiler.js` to distinguish
the two better and added comments.
- Separate the coverage directory setup and the connection
setup, moves the directory setup into `node.js` and
closer to the exit hooks because that's where it's used.
- Moves the `process.reallyExit` overwrite and
`process.on('exit')` hooks setup into bootstrap/node.js
for clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
PR-URL: nodejs#25398
Reviewed-By: Ben Coe <[email protected]>

internal/process/write-coverage.jstointernal/coverage-gen/with_instrumentation.js,internal/process/coverage.jstointernal/coverage-gen/with_profiler.jsto distinguishthe two better and added comments.
setup, moves the directory setup into
node.jsandcloser to the exit hooks because that's where it's used.
process.reallyExitoverwrite andprocess.on('exit')hooks setup into bootstrap/node.jsfor clarity, and move them to a later stage of
bootstrap since they do not have to happen that early.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes