node/test/parallel/test-coverage-with-inspector-disabled.js
Rich Trott fa2ba05bcd test: remove common.skipIfInspectorEnabled()
common.skipIfInspectorEnabled() is only used once in all of the tests.
The test is more clear (in my opinion, at least) without the abstraction
so put the check directly in the test. Additionally, it honestly looks
like an error (which is how I noticed it in the first place) and that
someone mistyped the far more common skipIfInspectorDisabled().

PR-URL: https://github.com/nodejs/node/pull/29993
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-10-18 11:32:04 -07:00

27 lines
705 B
JavaScript

'use strict';
const common = require('../common');
if (process.features.inspector) {
common.skip('V8 inspector is enabled');
}
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { spawnSync } = require('child_process');
const env = { ...process.env, NODE_V8_COVERAGE: '/foo/bar' };
const childPath = fixtures.path('v8-coverage/subprocess');
const { status, stderr } = spawnSync(
process.execPath,
[childPath],
{ env }
);
const warningMessage = 'The inspector is disabled, ' +
'coverage could not be collected';
assert.strictEqual(status, 0);
assert.strictEqual(
stderr.toString().includes(`Warning: ${warningMessage}`),
true
);