Skip to content

test: improve test coverage in test-child-process-spawn-argv0.js #44955

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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([])
});