-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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: expand error message #15991
test: expand error message #15991
Conversation
@@ -7,11 +7,11 @@ if (cluster.isMaster) { | |||
const worker = cluster.fork(); | |||
assert.ok( | |||
!worker.isDead(), | |||
'isDead() should return false right after the worker has been created.'); | |||
`isDead() returned ${worker.isDead()}. isDead() should return false right after the worker has been created.`); |
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.
The line length exceeds 80 characters. To make sure the function is only called a single time it would also be better to use a extra variable as in const workerState = !worker.isDead()
and check for that.
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.
@sharpstef ... woo! first PR! This is super close but as @BridgeAR indicates there are some style nits that can be addressed by the person landing the PR but definitely feel free to address. Specifically what @BridgeAR is asking for would be a change to make it look like:
const workerDead = worker.isDead;
assert.ok(!workerDead,
`isDead() returned ${workerDead}. isDead() should return ` +
'false right after the worker has been created.');
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.
On it
|
||
worker.on('exit', function() { | ||
assert.ok(worker.isDead(), | ||
'After an event has been emitted, isDead should return true'); | ||
assert.ok(workerDead, |
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.
Tests have failed:
not ok 282 parallel/test-cluster-worker-isdead
---
duration_ms: 0.460
severity: fail
stack: |-
assert.js:45
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: isDead() returned false. After an event has been emitted, isDead should return true
at Worker.<anonymous> (/usr/home/iojs/build/workspace/node-test-commit-freebsd/nodes/freebsd11-x64/test/parallel/test-cluster-worker-isdead.js:14:12)
at emitTwo (events.js:136:13)
at Worker.emit (events.js:227:7)
at ChildProcess.worker.process.once (internal/cluster/master.js:184:12)
at Object.onceWrapper (events.js:335:30)
at emitTwo (events.js:136:13)
at ChildProcess.emit (events.js:227:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:210:12)
...
ok 283 parallel/test-cluster-worker-kill
We cannot use the cached variable here. Please restore this to worker.isDead()
PR-URL: #15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in b07aa92 Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 ! |
PR-URL: #15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node#15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node#15991 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test