File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ 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() returned ${ worker . isDead ( ) } . isDead() should return false right after the worker has been created.` ) ;
8
+ const workerDead = worker . isDead ( ) ;
9
+ assert . ok ( ! workerDead ,
10
+ `isDead() returned ${ workerDead } . isDead() should return false ` +
11
+ 'right after the worker has been created.' ) ;
11
12
12
13
worker . on ( 'exit' , function ( ) {
13
- assert . ok ( worker . isDead ( ) ,
14
- `isDead() returned ${ worker . isDead ( ) } . After an event has been emitted, isDead should return true` ) ;
14
+ assert . ok ( workerDead ,
15
+ `isDead() returned ${ workerDead } . After an event has been ` +
16
+ 'emitted, isDead should return true' ) ;
15
17
} ) ;
16
18
17
19
worker . on ( 'message' , function ( msg ) {
@@ -21,7 +23,9 @@ if (cluster.isMaster) {
21
23
} ) ;
22
24
23
25
} else if ( cluster . isWorker ) {
24
- assert . ok ( ! cluster . worker . isDead ( ) ,
25
- `isDead() returned ${ cluster . worker . isDead ( ) } . isDead() should return false when called from within a worker` ) ;
26
+ const workerDead = cluster . worker . isDead ( ) ;
27
+ assert . ok ( ! workerDead ,
28
+ `isDead() returned ${ workerDead } . isDead() should return ` +
29
+ 'false when called from within a worker' ) ;
26
30
process . send ( 'readyToDie' ) ;
27
31
}
You can’t perform that action at this time.
0 commit comments