mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 05:41:13 +00:00

This fixes `parallel/test-cli-node-print-help` when Node.js is compiled without the inspector. PR-URL: https://github.com/nodejs/node/pull/22657 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
28 lines
702 B
JavaScript
28 lines
702 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.config.variables.v8_enable_inspector === 1) {
|
|
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`
|
|
);
|
|
}
|