diff --git a/test/parallel/test-child-process-spawn-argv0.js b/test/parallel/test-child-process-spawn-argv0.js index a426fe8053bbd8..334896949623be 100644 --- a/test/parallel/test-child-process-spawn-argv0.js +++ b/test/parallel/test-child-process-spawn-argv0.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); @@ -16,3 +16,12 @@ assert.strictEqual(noArgv0.stdout.toString().trim(), process.execPath); const withArgv0 = cp.spawnSync(process.execPath, [__filename, 'child'], { argv0: 'withArgv0' }); assert.strictEqual(withArgv0.stdout.toString().trim(), 'withArgv0'); + +assert.throws(() => { + cp.spawnSync(process.execPath, [__filename, 'child'], { argv0: [] }); +}, { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError', + message: 'The "options.argv0" property must be of type string.' + + common.invalidArgTypeHelper([]) +});