node/test/parallel/test-cli-bad-options.js
boydfd 5d06d0b607 test: change style in test-cli-bad-options
Replace string concatenation in test/parallel/test-cli-bad-options.js
with template literal. Adjust argument layout for readability.

PR-URL: https://github.com/nodejs/node/pull/14274
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-07-19 15:02:47 -04:00

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