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 <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
pull/36429/head
Moshe vilner 2020-12-07 16:01:25 +02:00 committed by Rich Trott
parent 8b697246df
commit 5dd58d069f
1 changed files with 11 additions and 0 deletions

View File

@ -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' });
}