Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bootstrap: updates the warning and adds test
  • Loading branch information
Shobhit Chittora authored and Trott committed Sep 23, 2019
commit c18a0dde1523a69eb644376816bb2b1939d3886a
4 changes: 3 additions & 1 deletion lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ function setupCoverageHooks(dir) {
internalBinding('profiler').setCoverageDirectory(coverageDirectory);
internalBinding('profiler').setSourceMapCacheGetter(sourceMapCacheToObject);
} catch {
process.emitWarning('Profiler is not enabled.', 'Warning');
process.emitWarning('The inspector is disabled, ' +
'coverage could not be collected',
'Warning');
}
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated
return coverageDirectory;
}
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/v8-coverage/subprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ setTimeout(() => {
const c = 102;
}
}, 10);

process.on('warning', console.log);
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated
23 changes: 23 additions & 0 deletions test/parallel/test-coverage-with-inspector-disabled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

require('../common');
const fixtures = require('../common/fixtures');

const assert = require('assert');
const { spawnSync } = require('child_process');
const env = Object.assign({}, process.env, { NODE_V8_COVERAGE: '/foo/bar' });
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated
const childPath = fixtures.path('v8-coverage/subprocess');
const { status, stderr } = spawnSync(
process.execPath,
[childPath],
{ env: env }
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated
);

const warningMessage = 'The inspector is disabled, ' +
'coverage could not be collected';

assert.strictEqual(status, 0);
assert.strictEqual(
stderr.toString().includes(`Warning: ${warningMessage}`),
true
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated
);