1'use strict'; 2require('../common'); 3 4// Tests that node exits consistently on bad option syntax. 5 6const assert = require('assert'); 7const { spawnSync } = require('child_process'); 8 9if (process.features.inspector) { 10 requiresArgument('--inspect-port'); 11 requiresArgument('--inspect-port='); 12 requiresArgument('--debug-port'); 13 requiresArgument('--debug-port='); 14} 15requiresArgument('--eval'); 16 17function requiresArgument(option) { 18 const r = spawnSync(process.execPath, [option], { encoding: 'utf8' }); 19 20 assert.strictEqual(r.status, 9); 21 22 const msg = r.stderr.split(/\r?\n/)[0]; 23 assert.strictEqual( 24 msg, 25 `${process.execPath}: ${option} requires an argument` 26 ); 27} 28