Commit 30c5a6596f5 for nodejs
commit 30c5a6596f589828a80d0bbdf9a7a625484b337e
Author: Jihwan <hanityx@gmail.com>
Date: Fri Sep 25 22:59:31 2026 +0900
test: ensure fsPromises.watch rejects on abort
Signed-off-by: hanityx <hanityx@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65768
Refs: https://github.com/nodejs/node/pull/58490
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
diff --git a/test/parallel/test-fs-promises-watch.js b/test/parallel/test-fs-promises-watch.js
index 65ac429a59a..397297b4f4c 100644
--- a/test/parallel/test-fs-promises-watch.js
+++ b/test/parallel/test-fs-promises-watch.js
@@ -146,10 +146,8 @@ assert.rejects(
const ac = new AbortController();
const { signal } = ac;
setImmediate(() => ac.abort());
- try {
+ await assert.rejects(async () => {
// eslint-disable-next-line no-unused-vars, no-empty
for await (const _ of watch(__filename, { signal })) { }
- } catch (err) {
- assert.strictEqual(err.name, 'AbortError');
- }
+ }, { name: 'AbortError' });
})().then(common.mustCall());