@@ -11,68 +11,72 @@ var appjs = path.resolve(dir, 'env.js');
11
11
var asCLI = utils . asCLI ;
12
12
var fork = require ( 'child_process' ) . fork ;
13
13
14
- describe ( 'events should follow normal flow on user triggered change' ,
15
- function ( ) {
16
- function conf ( ) {
17
- utils . port ++ ;
18
- return {
19
- script : appjs ,
20
- verbose : true ,
21
- stdout : false ,
22
- noReset : true ,
23
- ext : 'js' ,
24
- env : {
25
- PORT : utils . port ,
26
- USER : 'nodemon' ,
27
- } ,
28
- } ;
29
- }
14
+ describe ( 'events should follow normal flow on user triggered change' , function ( ) {
15
+ function conf ( ) {
16
+ utils . port ++ ;
17
+ return {
18
+ script : appjs ,
19
+ verbose : true ,
20
+ stdout : false ,
21
+ noReset : true ,
22
+ ext : 'js' ,
23
+ env : {
24
+ PORT : utils . port ,
25
+ NODEMON_ENV : 'nodemon' ,
26
+ } ,
27
+ } ;
28
+ }
30
29
31
- var cwd = process . cwd ( ) ;
30
+ var cwd = process . cwd ( ) ;
32
31
33
- beforeEach ( function ( done ) {
34
- debug ( 'beforeEach' ) ;
35
- nodemon . once ( 'exit' , function ( ) {
32
+ beforeEach ( function ( done ) {
33
+ debug ( 'beforeEach' ) ;
34
+ nodemon
35
+ . once ( 'exit' , function ( ) {
36
36
nodemon . reset ( done ) ;
37
- } ) . emit ( 'quit' ) ;
38
- } ) ;
37
+ } )
38
+ . emit ( 'quit' ) ;
39
+ } ) ;
39
40
40
- before ( function ( ) {
41
- process . chdir ( dir ) ;
42
- } ) ;
41
+ before ( function ( ) {
42
+ process . chdir ( dir ) ;
43
+ } ) ;
43
44
44
- after ( function ( done ) {
45
- debug ( 'after' ) ;
46
- process . chdir ( cwd ) ;
47
- nodemon . once ( 'exit' , function ( ) {
45
+ after ( function ( done ) {
46
+ debug ( 'after' ) ;
47
+ process . chdir ( cwd ) ;
48
+ nodemon
49
+ . once ( 'exit' , function ( ) {
48
50
nodemon . reset ( function ( ) {
49
51
setTimeout ( done , 1000 ) ;
50
52
} ) ;
51
- } ) . emit ( 'quit' ) ;
52
- } ) ;
53
+ } )
54
+ . emit ( 'quit' ) ;
55
+ } ) ;
53
56
54
- it ( 'start' , function ( done ) {
55
- debug ( 'start' ) ;
56
- nodemon ( conf ( ) ) . once ( 'start' , function ( ) {
57
- assert ( true , '"start" event' ) ;
58
- done ( ) ;
59
- } ) ;
57
+ it ( 'start' , function ( done ) {
58
+ debug ( 'start' ) ;
59
+ nodemon ( conf ( ) ) . once ( 'start' , function ( ) {
60
+ assert ( true , '"start" event' ) ;
61
+ done ( ) ;
60
62
} ) ;
63
+ } ) ;
61
64
62
- it ( 'config:update' , function ( done ) {
63
- nodemon ( conf ( ) ) . on ( 'config:update' , function ( ) {
64
- assert ( true , '"config:update" event' ) ;
65
- done ( ) ;
66
- } ) ;
65
+ it ( 'config:update' , function ( done ) {
66
+ nodemon ( conf ( ) ) . on ( 'config:update' , function ( ) {
67
+ assert ( true , '"config:update" event' ) ;
68
+ done ( ) ;
67
69
} ) ;
70
+ } ) ;
68
71
69
- it ( 'exit' , function ( done ) {
70
- var plan = new utils . Plan ( 4 , function ( ) {
71
- nodemon . reset ( done ) ;
72
- } ) ;
73
- var run = 0 ;
72
+ it ( 'exit' , function ( done ) {
73
+ var plan = new utils . Plan ( 4 , function ( ) {
74
+ nodemon . reset ( done ) ;
75
+ } ) ;
76
+ var run = 0 ;
74
77
75
- nodemon ( conf ( ) ) . on ( 'exit' , function ( ) {
78
+ nodemon ( conf ( ) )
79
+ . on ( 'exit' , function ( ) {
76
80
plan . assert ( true , '"exit" event' ) ;
77
81
if ( run === 1 ) {
78
82
setTimeout ( function ( ) {
@@ -84,33 +88,38 @@ describe('events should follow normal flow on user triggered change',
84
88
} else {
85
89
plan . assert ( false , 'quit too many times: ' + run ) ;
86
90
}
87
- } ) . on ( 'start' , function ( ) {
91
+ } )
92
+ . on ( 'start' , function ( ) {
88
93
run ++ ;
89
94
} ) ;
90
- } ) ;
95
+ } ) ;
91
96
92
- it ( 'stdout' , function ( done ) {
93
- nodemon ( conf ( ) ) . once ( 'stdout' , function ( data ) {
94
- assert ( true , '"stdout" event with: ' + data ) ;
95
- done ( ) ;
96
- } ) ;
97
+ it ( 'stdout' , function ( done ) {
98
+ nodemon ( conf ( ) ) . once ( 'stdout' , function ( data ) {
99
+ assert ( true , '"stdout" event with: ' + data ) ;
100
+ done ( ) ;
97
101
} ) ;
102
+ } ) ;
98
103
99
- it ( 'restart' , function ( done ) {
100
- var plan = new utils . Plan ( 4 , function ( ) {
101
- nodemon . reset ( done ) ;
102
- } ) ;
104
+ it ( 'restart' , function ( done ) {
105
+ var plan = new utils . Plan ( 4 , function ( ) {
106
+ nodemon . reset ( done ) ;
107
+ } ) ;
103
108
104
- nodemon ( conf ( ) ) . on ( 'restart' , function ( files ) {
109
+ nodemon ( conf ( ) )
110
+ . on ( 'restart' , function ( files ) {
105
111
plan . assert ( true , '"restart" event with ' + files ) ;
106
- plan . assert ( files [ 0 ] === appjs , 'restart due to ' + files . join ( ' ' ) +
107
- ' changing' ) ;
108
- } ) . once ( 'exit' , function ( ) {
112
+ plan . assert (
113
+ files [ 0 ] === appjs ,
114
+ 'restart due to ' + files . join ( ' ' ) + ' changing'
115
+ ) ;
116
+ } )
117
+ . once ( 'exit' , function ( ) {
109
118
plan . assert ( true , '"exit" event' ) ;
110
119
setTimeout ( function ( ) {
111
120
plan . assert ( true , 'restarting' ) ;
112
121
touch . sync ( appjs ) ;
113
122
} , 1500 ) ;
114
123
} ) ;
115
- } ) ;
116
124
} ) ;
125
+ } ) ;
0 commit comments