Skip to content
Closed
Changes from 1 commit
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
Next Next commit
test: expand error message
  • Loading branch information
sharpstef committed Oct 15, 2017
commit a91ed7ea4cc17c1c434bd21e1d2bab4c47074442
6 changes: 3 additions & 3 deletions test/parallel/test-cluster-worker-isdead.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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.');

Copy link
Copy Markdown
Contributor Author

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');
`isDead() returned ${worker.isDead()}. After an event has been emitted, isDead should return true`);
});

worker.on('message', function(msg) {
Expand All @@ -22,6 +22,6 @@ if (cluster.isMaster) {

} else if (cluster.isWorker) {
assert.ok(!cluster.worker.isDead(),
'isDead() should return false when called from within a worker');
`isDead() returned ${cluster.worker.isDead()}. isDead() should return false when called from within a worker`);
process.send('readyToDie');
}