Skip to content

Commit 386d761

Browse files
authored
test: improve test coverage in test-child-process-spawn-argv0.js
PR-URL: #44955 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 10f9367 commit 386d761

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/parallel/test-child-process-spawn-argv0.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const cp = require('child_process');
55

@@ -16,3 +16,12 @@ assert.strictEqual(noArgv0.stdout.toString().trim(), process.execPath);
1616
const withArgv0 = cp.spawnSync(process.execPath, [__filename, 'child'],
1717
{ argv0: 'withArgv0' });
1818
assert.strictEqual(withArgv0.stdout.toString().trim(), 'withArgv0');
19+
20+
assert.throws(() => {
21+
cp.spawnSync(process.execPath, [__filename, 'child'], { argv0: [] });
22+
}, {
23+
code: 'ERR_INVALID_ARG_TYPE',
24+
name: 'TypeError',
25+
message: 'The "options.argv0" property must be of type string.' +
26+
common.invalidArgTypeHelper([])
27+
});

0 commit comments

Comments
 (0)