summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoshe vilner <shootermv@gmail.com>2021-01-01 08:34:42 +0200
committerMichaƫl Zasso <targos@protonmail.com>2021-02-02 10:42:01 +0100
commitda07eb654ece4d990517972d1496b584c65a01f5 (patch)
tree66baa70203622bcf3cc4c2ca91e546d2cd031c82
parentc4193ba8ae315882ebfa7a2e3c9908e725c32984 (diff)
downloadnode-new-da07eb654ece4d990517972d1496b584c65a01f5.tar.gz
test: increase read file abort coverage
PR-URL: https://github.com/nodejs/node/pull/36716 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r--test/parallel/test-fs-readfile.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/parallel/test-fs-readfile.js b/test/parallel/test-fs-readfile.js
index 3e61a465b5..b7d798a5db 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' });
+}