0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-inspector-invalid-args.js
cjihrig b851469855
src: simplify DEP0062 logic
This commit simplifies the DEP0062 error logic. Instead of
looking for certain combinations of flags, just show an error
for any usage of --debug or --debug-brk.

PR-URL: https://github.com/nodejs/node/pull/28589
Fixes: https://github.com/nodejs/node/issues/28588
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-07-09 16:50:59 -04:00

28 lines
801 B
JavaScript

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
common.skipIfInspectorDisabled();
const assert = require('assert');
const execFile = require('child_process').execFile;
const mainScript = fixtures.path('loop.js');
const expected =
'`node --debug` and `node --debug-brk` are invalid. ' +
'Please use `node --inspect` and `node --inspect-brk` instead.';
for (const invalidArg of ['--debug-brk', '--debug']) {
execFile(
process.execPath,
[invalidArg, mainScript],
common.mustCall((error, stdout, stderr) => {
assert.strictEqual(error.code, 9, `node ${invalidArg} should exit 9`);
assert.strictEqual(
stderr.includes(expected),
true,
`${stderr} should include '${expected}'`
);
})
);
}