mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
bb29405904
PR-URL: https://github.com/nodejs/node/pull/14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
26 lines
634 B
JavaScript
26 lines
634 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;
|
|
|
|
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`
|
|
);
|
|
}
|