-
Notifications
You must be signed in to change notification settings - Fork 30k
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: refactor test-child-process-send-type-error.js #13904
test: refactor test-child-process-send-type-error.js #13904
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to run the test in the child process to make sure child.send()
and process.send()
behave the same.
Can I suggest adding an exit
event handler in the parent to make sure the child process exited normally. That seems to fix the problem on my machine.
e810393
to
a575bbf
Compare
@cjihrig Reworked to address your comment. PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one suggestion.
target = cp.fork(__filename, ['child']); | ||
target.on('exit', (code) => { assert.strictEqual(code, 0); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.mustCall()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.strictEqual(signal, null);
?
target = cp.fork(__filename, ['child']); | ||
target.on('exit', (code) => { assert.strictEqual(code, 0); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.strictEqual(signal, null);
?
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide.
a575bbf
to
c874808
Compare
Addressed further nits. CI: https://ci.nodejs.org/job/node-test-pull-request/8880/ |
Landed in 93683c6 |
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: nodejs#13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* Add exit listener to child process to check return code. Previously, child process faiilure would not cause the test to fail. * Use common.mustNotCall() to guarantee callback is not invoked. * Insert blank line per test writing guide. PR-URL: #13904 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
test to fail. Only run the tests in the parent process where their
failure means the test fails.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test child_process