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: expand error message #15991

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
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
19 changes: 12 additions & 7 deletions test/parallel/test-cluster-worker-isdead.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ const assert = require('assert');

if (cluster.isMaster) {
const worker = cluster.fork();
assert.ok(
!worker.isDead(),
'isDead() should return false right after the worker has been created.');
let workerDead = worker.isDead();
assert.ok(!workerDead,
`isDead() returned ${workerDead}. isDead() should return ` +
'false right after the worker has been created.');

worker.on('exit', function() {
assert.ok(worker.isDead(),
'After an event has been emitted, isDead should return true');
workerDead = worker.isDead();
assert.ok(workerDead,
`isDead() returned ${workerDead}. After an event has been ` +
'emitted, isDead should return true');
});

worker.on('message', function(msg) {
Expand All @@ -21,7 +24,9 @@ if (cluster.isMaster) {
});

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