diff --git a/lib/utils/build-safe-sonic-boom.js b/lib/utils/build-safe-sonic-boom.js index 1ed1f6e7..fadfe290 100644 --- a/lib/utils/build-safe-sonic-boom.js +++ b/lib/utils/build-safe-sonic-boom.js @@ -17,6 +17,11 @@ function buildSafeSonicBoom (opts) { const stream = new SonicBoom(opts) stream.on('error', filterBrokenPipe) // if we are sync: false, we must flush on exit + // NODE_V8_COVERAGE must breaks everything + // https://github.com/nodejs/node/issues/49344 + if (!process.env.NODE_V8_COVERAGE && !opts.sync && isMainThread) { + setupOnExit(stream) + } if (!opts.sync && isMainThread) { setupOnExit(stream) }