Skip to content

Commit

Permalink
register a timeout in AbortSignal.any test
Browse files Browse the repository at this point in the history
Refs:  nodejs/node#47821 (comment)

Because of the (i assume) weak references this test doesn't cause the Node.js worker that executes the tests to emit result and therefore completion of the suite.

This change makes it so that a timeout is registered that should never be reached whilst still testing the combinedSignal behaviours.
  • Loading branch information
panva committed May 7, 2023
1 parent 67f0803 commit 4e5641c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dom/abort/resources/abort-signal-any-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ function abortSignalAnyTests(signalInterface, controllerInterface) {

const combinedSignal = signalInterface.any([controller.signal, timeoutSignal]);

const ref = setTimeout(assert_unreached, 10);
combinedSignal.onabort = t.step_func_done(() => {
assert_true(combinedSignal.aborted);
assert_true(combinedSignal.reason instanceof DOMException,
"combinedSignal.reason is a DOMException");
assert_equals(combinedSignal.reason.name, "TimeoutError",
"combinedSignal.reason is a TimeoutError");
clearTimeout(ref);
});
}, `${desc} works with signals returned by AbortSignal.timeout() ${suffix}`);

Expand Down

0 comments on commit 4e5641c

Please sign in to comment.