mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 09:52:21 +00:00

Instead of using process.config.variables.v8_enable_inspector to detect whether inspector is enabled in the build. PR-URL: https://github.com/nodejs/node/pull/25819 Refs: https://github.com/nodejs/node/issues/25343 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
28 lines
678 B
JavaScript
28 lines
678 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// Tests that node exits consistently on bad option syntax.
|
|
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawnSync;
|
|
|
|
if (process.features.inspector) {
|
|
requiresArgument('--inspect-port');
|
|
requiresArgument('--inspect-port=');
|
|
requiresArgument('--debug-port');
|
|
requiresArgument('--debug-port=');
|
|
}
|
|
requiresArgument('--eval');
|
|
|
|
function requiresArgument(option) {
|
|
const r = spawn(process.execPath, [option], { encoding: 'utf8' });
|
|
|
|
assert.strictEqual(r.status, 9);
|
|
|
|
const msg = r.stderr.split(/\r?\n/)[0];
|
|
assert.strictEqual(
|
|
msg,
|
|
`${process.execPath}: ${option} requires an argument`
|
|
);
|
|
}
|