From 5a801563c9e880f81961985169f97996981c79b3 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 --- 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 751043886f0d96..8273b864907c9f 100644 --- a/test/parallel/test-fs-readfile.js +++ b/test/parallel/test-fs-readfile.js @@ -75,3 +75,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' }); +}