@@ -30,14 +30,12 @@ assert(cluster.isMaster);
3030// makes that unnecessary. This is to make the test less fragile if the
3131// implementation ever changes such that cluster.settings is mutated instead of
3232// replaced.
33- function cheapClone ( obj ) {
34- return JSON . parse ( JSON . stringify ( obj ) ) ;
35- }
33+ const cheapClone = ( obj ) => JSON . parse ( JSON . stringify ( obj ) ) ;
3634
3735const configs = [ ] ;
3836
3937// Capture changes
40- cluster . on ( 'setup' , function ( ) {
38+ cluster . on ( 'setup' , ( ) => {
4139 console . log ( '"setup" emitted' , cluster . settings ) ;
4240 configs . push ( cheapClone ( cluster . settings ) ) ;
4341} ) ;
@@ -48,7 +46,7 @@ const execs = [
4846 'node-next-3' ,
4947] ;
5048
51- process . on ( 'exit' , function assertTests ( ) {
49+ process . on ( 'exit' , ( ) => {
5250 // Tests that "setup" is emitted for every call to setupMaster
5351 assert . strictEqual ( configs . length , execs . length ) ;
5452
@@ -58,14 +56,14 @@ process.on('exit', function assertTests() {
5856} ) ;
5957
6058// Make changes to cluster settings
61- execs . forEach ( function ( v , i ) {
62- setTimeout ( function ( ) {
59+ execs . forEach ( ( v , i ) => {
60+ setTimeout ( ( ) => {
6361 cluster . setupMaster ( { exec : v } ) ;
6462 } , i * 100 ) ;
6563} ) ;
6664
6765// cluster emits 'setup' asynchronously, so we must stay alive long
6866// enough for that to happen
69- setTimeout ( function ( ) {
67+ setTimeout ( ( ) => {
7068 console . log ( 'cluster setup complete' ) ;
7169} , ( execs . length + 1 ) * 100 ) ;
0 commit comments