Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable FinalizationRegistry if node code coverage is active #1819

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ function hasBeenTampered (stream) {
return stream.write !== stream.constructor.prototype.write
}

const hasNodeCodeCoverage = process.env.NODE_V8_COVERAGE || process.env.V8_COVERAGE

function buildSafeSonicBoom (opts) {
const stream = new SonicBoom(opts)
stream.on('error', filterBrokenPipe)
// if we are sync: false, we must flush on exit
if (!opts.sync && isMainThread) {
// If we are sync: false, we must flush on exit
// We must disable this if there is node code coverage due to
// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308.
if (!hasNodeCodeCoverage && !opts.sync && isMainThread) {
onExit.register(stream, autoEnd)

stream.on('close', function () {
Expand Down