node/test/parallel/test-coverage-with-inspector-disabled.js
Shobhit Chittora fdd5d4ad4a
bootstrap: add exception handling for profiler bootstrap
Add exception handling for the case when profile is
not bootstrapped when coverage is enabled.

Fixes: https://github.com/nodejs/node/issues/29542

PR-URL: https://github.com/nodejs/node/pull/29552
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-09-23 12:04:20 +02:00

25 lines
660 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorEnabled();
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
);