0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-cli-bad-options.js
Sebastiaan Deckers bb29405904
lib,src: fix consistent spacing inside braces
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>
2017-07-21 15:13:47 -04:00

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`
);
}