Skip to content

Commit cf8d025

Browse files
shootermvtargos
authored andcommitted
test: increase abort logic coverage
PR-URL: #36586 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent c308b06 commit cf8d025

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-fs-promises-readfile.js

+12
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,22 @@ function validateReadFileAbortLogicDuring() {
6161
});
6262
}
6363

64+
async function validateWrongSignalParam() {
65+
// Verify that if something different than Abortcontroller.signal
66+
// is passed, ERR_INVALID_ARG_TYPE is thrown
67+
68+
await assert.rejects(async () => {
69+
const callback = common.mustNotCall(() => {});
70+
await readFile(fn, { signal: 'hello' }, callback);
71+
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
72+
73+
}
74+
6475
(async () => {
6576
await createLargeFile();
6677
await validateReadFile();
6778
await validateReadFileProc();
6879
await validateReadFileAbortLogicBefore();
6980
await validateReadFileAbortLogicDuring();
81+
await validateWrongSignalParam();
7082
})().then(common.mustCall());

0 commit comments

Comments
 (0)