From da07eb654ece4d990517972d1496b584c65a01f5 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 3e61a465b55b43..b7d798a5db8e9b 100644 --- a/test/parallel/test-fs-readfile.js +++ b/test/parallel/test-fs-readfile.js @@ -70,3 +70,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' }); +}