| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cbbe125 commit da85e6c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,13 +5,16 @@ const assert = require('assert'); | |||
| 5 | 5 | ||
| 6 | 6 | if (cluster.isMaster) { | |
| 7 | 7 | const worker = cluster.fork(); | |
| 8 | - assert.ok( | ||
| 9 | - !worker.isDead(), | ||
| 10 | - 'isDead() should return false right after the worker has been created.'); | ||
| 8 | + let workerDead = worker.isDead(); | ||
| 9 | + assert.ok(!workerDead, | ||
| 10 | + `isDead() returned ${workerDead}. isDead() should return ` + | ||
| 11 | + 'false right after the worker has been created.'); | ||
| 11 | 12 | ||
| 12 | 13 | worker.on('exit', function() { | |
| 13 | - assert.ok(worker.isDead(), | ||
| 14 | - 'After an event has been emitted, isDead should return true'); | ||
| 14 | + workerDead = worker.isDead(); | ||
| 15 | + assert.ok(workerDead, | ||
| 16 | + `isDead() returned ${workerDead}. After an event has been ` + | ||
| 17 | + 'emitted, isDead should return true'); | ||
| 15 | 18 | }); | |
| 16 | 19 | ||
| 17 | 20 | worker.on('message', function(msg) { | |
@@ -21,7 +24,9 @@ if (cluster.isMaster) { | |||
| 21 | 24 | }); | |
| 22 | 25 | ||
| 23 | 26 | } else if (cluster.isWorker) { | |
| 24 | - assert.ok(!cluster.worker.isDead(), | ||
| 25 | - 'isDead() should return false when called from within a worker'); | ||
| 27 | + const workerDead = cluster.worker.isDead(); | ||
| 28 | + assert.ok(!workerDead, | ||
| 29 | + `isDead() returned ${workerDead}. isDead() should return ` + | ||
| 30 | + 'false when called from within a worker'); | ||
| 26 | 31 | process.send('readyToDie'); | |
| 27 | 32 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments