@@ -30,14 +30,12 @@ assert(cluster.isMaster);
30
30
// makes that unnecessary. This is to make the test less fragile if the
31
31
// implementation ever changes such that cluster.settings is mutated instead of
32
32
// replaced.
33
- function cheapClone ( obj ) {
34
- return JSON . parse ( JSON . stringify ( obj ) ) ;
35
- }
33
+ const cheapClone = ( obj ) => JSON . parse ( JSON . stringify ( obj ) ) ;
36
34
37
35
const configs = [ ] ;
38
36
39
37
// Capture changes
40
- cluster . on ( 'setup' , function ( ) {
38
+ cluster . on ( 'setup' , ( ) => {
41
39
console . log ( '"setup" emitted' , cluster . settings ) ;
42
40
configs . push ( cheapClone ( cluster . settings ) ) ;
43
41
} ) ;
@@ -48,7 +46,7 @@ const execs = [
48
46
'node-next-3' ,
49
47
] ;
50
48
51
- process . on ( 'exit' , function assertTests ( ) {
49
+ process . on ( 'exit' , ( ) => {
52
50
// Tests that "setup" is emitted for every call to setupMaster
53
51
assert . strictEqual ( configs . length , execs . length ) ;
54
52
@@ -58,14 +56,14 @@ process.on('exit', function assertTests() {
58
56
} ) ;
59
57
60
58
// Make changes to cluster settings
61
- execs . forEach ( function ( v , i ) {
62
- setTimeout ( function ( ) {
59
+ execs . forEach ( ( v , i ) => {
60
+ setTimeout ( ( ) => {
63
61
cluster . setupMaster ( { exec : v } ) ;
64
62
} , i * 100 ) ;
65
63
} ) ;
66
64
67
65
// cluster emits 'setup' asynchronously, so we must stay alive long
68
66
// enough for that to happen
69
- setTimeout ( function ( ) {
67
+ setTimeout ( ( ) => {
70
68
console . log ( 'cluster setup complete' ) ;
71
69
} , ( execs . length + 1 ) * 100 ) ;
0 commit comments