Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/parallel/test-worker-message-port-infinite-message-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
})
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more correct way to do this would be to wrap the callback to the port1.on in a common.mustCallAtLeast(...)?

Loading