Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1aaadb9

Browse filesBrowse files
Jarred-Sumnertargos
authored andcommitted
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: #59885 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 64e738a commit 1aaadb9
Copy full SHA for 1aaadb9

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-worker-message-port-infinite-message-loop.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-worker-message-port-infinite-message-loop.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,14 @@ port2.postMessage(0);
2727
// This is part of the test -- the event loop should be available and not stall
2828
// out due to the recursive .postMessage() calls.
2929
setTimeout(common.mustCall(), 0);
30+
31+
// Assert that the 'message' handler was actually called.
32+
//
33+
// We do not want to assert a specific call count, so common.mustCall cannot be
34+
// used in the port1.on('message' callback directly.
35+
process.once(
36+
'beforeExit',
37+
common.mustCall(() => {
38+
assert(count > 0, 'count should be greater than 0');
39+
})
40+
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.