Skip to content

Commit

Permalink
Disable FinalizationRegistry if node code coverage is active (#1819)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina authored Oct 1, 2023
1 parent 66274aa commit 8465234
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 8465234

Please sign in to comment.