@@ -36,26 +36,29 @@ if (cluster.isMaster) {
36
36
cluster . on ( 'exit' , ( ) => {
37
37
count += 1 ;
38
38
if ( count === 2 ) {
39
- test ( 'PM2 Support' , ( batch ) => {
40
- batch . test ( 'should not get any events when turned off' , ( t ) => {
41
- t . notOk ( appEvents [ '0' ] . filter ( e => e && e . data [ 0 ] . indexOf ( 'will not be logged' ) > - 1 ) . length ) ;
42
- t . notOk ( appEvents [ '1' ] . filter ( e => e && e . data [ 0 ] . indexOf ( 'will not be logged' ) > - 1 ) . length ) ;
43
8000
- t . end ( ) ;
44
- } ) ;
39
+ // wait for any IPC messages still to come, because it seems they are slooooow.
40
+ setTimeout ( ( ) => {
41
+ test ( 'PM2 Support' , ( batch ) => {
42
+ batch . test ( 'should not get any events when turned off' , ( t ) => {
43
+ t . notOk ( appEvents [ '0' ] . filter ( e => e && e . data [ 0 ] . indexOf ( 'will not be logged' ) > - 1 ) . length ) ;
44
+ t . notOk ( appEvents [ '1' ] . filter ( e => e && e . data [ 0 ] . indexOf ( 'will not be logged' ) > - 1 ) . length ) ;
45
+ t . end ( ) ;
46
+ } ) ;
45
47
46
- batch . test ( 'should get events on app instance 0' , ( t ) => {
47
- t . equal ( appEvents [ '0' ] . length , 2 ) ;
48
- t . equal ( appEvents [ '0' ] [ 0 ] . data [ 0 ] , 'this should now get logged' ) ;
49
- t . equal ( appEvents [ '0' ] [ 1 ] . data [ 0 ] , 'this should now get logged' ) ;
50
- t . end ( ) ;
51
- } ) ;
48
+ batch . test ( 'should get events on app instance 0' , ( t ) => {
49
+ t . equal ( appEvents [ '0' ] . length , 2 ) ;
50
+ t . equal ( appEvents [ '0' ] [ 0 ] . data [ 0 ] , 'this should now get logged' ) ;
51
+ t . equal ( appEvents [ '0' ] [ 1 ] . data [ 0 ] , 'this should now get logged' ) ;
52
+ t . end ( ) ;
53
+ } ) ;
52
54
53
- batch . test ( 'should not get events on app instance 1' , ( t ) => {
54
- t . equal ( appEvents [ '1' ] . length , 0 ) ;
55
- t . end ( ) ;
55
+ batch . test ( 'should not get events on app instance 1' , ( t ) => {
56
+ t . equal ( appEvents [ '1' ] . length , 0 ) ;
57
+ t . end ( ) ;
58
+ } ) ;
59
+ batch . end ( ) ;
56
60
} ) ;
57
- batch . end ( ) ;
58
- } ) ;
61
+ } , 1000 ) ;
59
62
}
60
63
cluster . removeListener ( 'message' , messageHandler ) ;
61
64
} ) ;
0 commit comments