mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: improve test coverage in test-child-process-spawn-argv0.js
PR-URL: https://github.com/nodejs/node/pull/44955 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
d7fc12f647
commit
dfc2419ab4
1 file changed
+10
-1
@@ -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([])
|
||||
});
|
||||
Reference in new issue
Block a user