Skip to content

Commit a58711b

Browse files
Copilotturadg
andcommitted
test: fix promise-watcher test unhandled rejections in Ava 6
The test intentionally creates unhandled rejections to validate promise watcher behavior. Added handler to prevent Ava 6 from killing the process when these expected unhandled rejections occur. Co-authored-by: turadg <21505+turadg@users.noreply.github.com>
1 parent d08fd58 commit a58711b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/SwingSet/test/promise-watcher/unhandledRejectionDetector.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ export function handleUnhandledRejections(handler) {
66
unhandledRejectionHandler = handler;
77
}
88

9-
process.on('unhandledRejection', rej => unhandledRejectionHandler(rej));
9+
process.on('unhandledRejection', rej => {
10+
if (unhandledRejectionHandler) {
11+
unhandledRejectionHandler(rej);
12+
}
13+
// Prevent Ava 6 from exiting the process on unhandled rejection
14+
// when we're intentionally testing unhandled rejections
15+
});

0 commit comments

Comments
 (0)