From 482578682c9d14d95500a22d673f0ac73563e30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9?= Date: Fri, 14 Oct 2022 13:24:26 -0500 Subject: [PATCH] test: improve test coverage in `test-child-process-spawn-argv0.js` PR-URL: https://github.com/nodejs/node/pull/44955 Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/parallel/test-child-process-spawn-argv0.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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([]) +});