From dc63ca686eec82683bc90212d9f6b64b4db907e7 Mon Sep 17 00:00:00 2001 From: Moshe vilner Date: Mon, 7 Dec 2020 16:01:25 +0200 Subject: [PATCH] test: increase execFile abort coverage Verify that if something different than Abortcontroller.signal is passed to child_process.execFile(), ERR_INVALID_ARG_TYPE is thrown. PR-URL: https://github.com/nodejs/node/pull/36429 Backport-PR-URL: https://github.com/nodejs/node/pull/38386 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- test/parallel/test-child-process-execfile.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/parallel/test-child-process-execfile.js b/test/parallel/test-child-process-execfile.js index 389ad73c228762..6012072eb297d1 100644 --- a/test/parallel/test-child-process-execfile.js +++ b/test/parallel/test-child-process-execfile.js @@ -60,3 +60,14 @@ const execOpts = { encoding: 'utf8', shell: true }; execFile(process.execPath, [echoFixture, 0], { signal }, callback); ac.abort(); } + +{ + // Verify that if something different than Abortcontroller.signal + // is passed, ERR_INVALID_ARG_TYPE is thrown + assert.throws(() => { + const callback = common.mustNotCall(() => {}); + + execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback); + }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); + +}