Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add a request-response test for MessageChannel #21514

Closed
wants to merge 1 commit into from

Conversation

itaysabato
Copy link
Contributor

@itaysabato itaysabato commented Jun 24, 2018

This commit adds a request-response test for MessageChannel.

Suggested by @benjamingr and @TimothyGu here

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jun 24, 2018
@mscdex
Copy link
Contributor

mscdex commented Jun 24, 2018

The commit message prefix should be test: instead of worker: if only tests are being added.

const { port1, port2 } = new MessageChannel();

port1.on('message', common.mustCall((message) => {
assert.strictEqual(message, 4);
Copy link
Member

Choose a reason for hiding this comment

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

Could port.onmessage = also be tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used it here (line 31).
Did you have something more elaborate in mind?

Copy link
Member

@targos targos Jun 25, 2018

Choose a reason for hiding this comment

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

I commented on the wrong line, sorry. My suggestion is to use it for both port1 and port2 (also do port1.onmessage = ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, why not :)

@itaysabato itaysabato changed the title worker: add a request-response test for MessageChannel test: add a request-response test for MessageChannel Jun 25, 2018
Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@benjamingr
Copy link
Member

benjamingr commented Jun 25, 2018

@itaysabato
Copy link
Contributor Author

Build and test pass locally in both mac and windows. This CI failure may be a glitch...

This commit adds a request-response test for MessageChannel.

PR-URL: nodejs#21514
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@benjamingr benjamingr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 27, 2018
jasnell pushed a commit that referenced this pull request Jun 29, 2018
This commit adds a request-response test for MessageChannel.

PR-URL: #21514
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Jun 29, 2018

Landed in 71e1602

@jasnell jasnell closed this Jun 29, 2018
@itaysabato itaysabato deleted the roundtrip branch June 29, 2018 20:23
targos pushed a commit that referenced this pull request Jun 30, 2018
This commit adds a request-response test for MessageChannel.

PR-URL: #21514
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos targos mentioned this pull request Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants