diff options
Diffstat (limited to 'lib/internal/bootstrap/loaders.js')
-rw-r--r-- | lib/internal/bootstrap/loaders.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 300a362abb..4554526298 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -329,7 +329,14 @@ NativeModule.prototype.compile = function() { // Coverage must be turned on early, so that we can collect // it for Node.js' own internal libraries. if (process.env.NODE_V8_COVERAGE) { - NativeModule.require('internal/process/coverage').setup(); + if (internalBinding('config').hasInspector) { + const coverage = + NativeModule.require('internal/coverage-gen/with_profiler'); + // Inform the profiler to start collecting coverage + coverage.startCoverageCollection(); + } else { + process._rawDebug('NODE_V8_COVERAGE cannot be used without inspector'); + } } function internalBindingWhitelistHas(name) { |