Skip to content

Commit

Permalink
test: improve test coverage in test-child-process-spawn-argv0.js
Browse files Browse the repository at this point in the history
PR-URL: #44955
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
juanarbol authored and RafaelGSS committed Nov 10, 2022
1 parent f0c18f0 commit 4825786
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/parallel/test-child-process-spawn-argv0.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');

Expand All @@ -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([])
});

0 comments on commit 4825786

Please sign in to comment.