From 5dd58d069fd31e778d050a2ffc7af8e64af30095 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 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 3cd4be091c6..a6345a7e5f6 100644 --- a/test/parallel/test-child-process-execfile.js +++ b/test/parallel/test-child-process-execfile.js @@ -59,3 +59,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' }); + +}