From 8f580df5ac5fcefa18832dc56c3b4a1f4e48a44c Mon Sep 17 00:00:00 2001 From: Moshe vilner Date: Fri, 1 Jan 2021 08:34:42 +0200 Subject: [PATCH] test: increase read file abort coverage PR-URL: https://github.com/nodejs/node/pull/36716 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Zijian Liu Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-fs-readfile.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-fs-readfile.js b/test/parallel/test-fs-readfile.js index b5cfabc547a..9be20d1a003 100644 --- a/test/parallel/test-fs-readfile.js +++ b/test/parallel/test-fs-readfile.js @@ -76,3 +76,11 @@ for (const e of fileInfo) { })); process.nextTick(() => controller.abort()); } +{ + // Verify that if something different than Abortcontroller.signal + // is passed, ERR_INVALID_ARG_TYPE is thrown + assert.throws(() => { + const callback = common.mustNotCall(() => {}); + fs.readFile(fileInfo[0].name, { signal: 'hello' }, callback); + }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); +}