mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
test: ensure message event fires in worker message port test
Add assertion to verify that the MessagePort's message event is actually emitted in test-worker-message-port-infinite-message-loop.js. Previously, the test could pass even if the event was not fired. PR-URL: https://github.com/nodejs/node/pull/59885 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
3dc8c57204
commit
9790315e15
|
|
@ -27,3 +27,14 @@ port2.postMessage(0);
|
|||
// This is part of the test -- the event loop should be available and not stall
|
||||
// out due to the recursive .postMessage() calls.
|
||||
setTimeout(common.mustCall(), 0);
|
||||
|
||||
// Assert that the 'message' handler was actually called.
|
||||
//
|
||||
// We do not want to assert a specific call count, so common.mustCall cannot be
|
||||
// used in the port1.on('message' callback directly.
|
||||
process.once(
|
||||
'beforeExit',
|
||||
common.mustCall(() => {
|
||||
assert(count > 0, 'count should be greater than 0');
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user