11/*global describe:true, it: true */
22var assert = require ( 'assert' ) ,
3- utils = require ( '../utils' ) ,
4- appjs = utils . appjs ,
5- run = utils . run ;
3+ utils = require ( '../utils' ) ,
4+ appjs = utils . appjs ,
5+ run = utils . run ;
66
77describe ( 'nodemon fork' , function ( ) {
88 it ( 'should start a fork' , function ( done ) {
@@ -30,77 +30,17 @@ describe('nodemon fork', function () {
3030 // make nodemon verbose so we can check the filters being applied
3131 args : [ '-q' , '--exec' , 'test/fixtures/app\\ with\\ spaces.js' ]
3232 } , {
33- error : function ( data ) {
34- p . send ( 'quit' ) ;
35- done ( new Error ( data ) ) ;
36- } ,
37- output : function ( data ) {
38- // process.stdout.write(data);
39- if ( data . trim ( ) === 'OK' ) {
40- found = true ;
41- }
42- }
43- } ) ;
44-
45- p . on ( 'message' , function ( event ) {
46- if ( event . type === 'start' ) {
47- setTimeout ( function ( ) {
33+ error : function ( data ) {
4834 p . send ( 'quit' ) ;
49- done ( ) ;
50- assert ( found , '"OK" message was found' ) ;
51- } , 500 ) ;
52- }
53- } ) ;
54- } ) ;
55-
56- it ( 'should start a fork exec with quotes and escaping' , function ( done ) {
57- var found = false ;
58- var p = run ( {
59- exec : 'bin/nodemon.js' ,
60- // make nodemon verbose so we can check the filters being applied
61- args : [ '-q' , '--exec' , 'test/fixtures/some\\\"file' ]
62- } , {
63- error : function ( data ) {
64- p . send ( 'quit' ) ;
65- done ( new Error ( data ) ) ;
66- } ,
67- output : function ( data ) {
68- // process.stdout.write(data);
69- if ( data . trim ( ) === 'OK' ) {
70- found = true ;
35+ done ( new Error ( data ) ) ;
36+ } ,
37+ output : function ( data ) {
38+ // process.stdout.write(data);
39+ if ( data . trim ( ) === 'OK' ) {
40+ found = true ;
41+ }
7142 }
72- }
73- } ) ;
74-
75- p . on ( 'message' , function ( event ) {
76- if ( event . type === 'start' ) {
77- setTimeout ( function ( ) {
78- p . send ( 'quit' ) ;
79- done ( ) ;
80- assert ( found , '"OK" message was found' ) ;
81- } , 500 ) ;
82- }
83- } ) ;
84- } ) ;
85-
86- it ( 'should start a fork exec with spaces and slashes' , function ( done ) {
87- var found = false ;
88- var p = run ( {
89- exec : 'bin/nodemon.js' ,
90- // make nodemon verbose so we can check the filters being applied
91- args : [ '-q' , '--exec' , '"test/fixtures/some\ \\file"' ]
92- } , {
93- error : function ( data ) {
94- p . send ( 'quit' ) ;
95- done ( new Error ( data ) ) ;
96- } ,
97- output : function ( data ) {
98- // process.stdout.write(data);
99- if ( data . trim ( ) === 'OK' ) {
100- found = true ;
101- }
102- }
103- } ) ;
43+ } ) ;
10444
10545 p . on ( 'message' , function ( event ) {
10646 if ( event . type === 'start' ) {
@@ -120,16 +60,16 @@ describe('nodemon fork', function () {
12060 // make nodemon verbose so we can check the filters being applied
12161 args : [ '-q' , '--exec' , '"test/fixtures/app with spaces.js" foo' ] ,
12262 } , {
123- error : function ( data ) {
124- p . send ( 'quit' ) ;
125- done ( new Error ( data ) ) ;
126- } ,
127- output : function ( data ) {
128- if ( data . trim ( ) === 'foo' ) {
129- found = true ;
63+ error : function ( data ) {
64+ p . send ( 'quit' ) ;
65+ done ( new Error ( data ) ) ;
66+ } ,
67+ output : function ( data ) {
68+ if ( data . trim ( ) === 'foo' ) {
69+ found = true ;
70+ }
13071 }
131- }
132- } ) ;
72+ } ) ;
13373
13474 p . on ( 'message' , function ( event ) {
13575 if ( event . type === 'start' ) {
@@ -151,17 +91,17 @@ describe('nodemon fork', function () {
15191 // make nodemon verbose so we can check the filters being applied
15292 args : [ '-q' , '--exec' , 'test/fixtures/app\\ with\\ spaces.js foo' ]
15393 } , {
154- error : function ( data ) {
155- p . send ( 'quit' ) ;
156- done ( new Error ( data ) ) ;
157- } ,
158- output : function ( data ) {
159- // process.stdout.write(data);
160- if ( data . trim ( ) === 'foo' ) {
161- found = true ;
94+ error : function ( data ) {
95+ p . send ( 'quit' ) ;
96+ done ( new Error ( data ) ) ;
97+ } ,
98+ output : function ( data ) {
99+ // process.stdout.write(data);
100+ if ( data . trim ( ) === 'foo' ) {
101+ found = true ;
102+ }
162103 }
163- }
164- } ) ;
104+ } ) ;
165105
166106 p . on ( 'message' , function ( event ) {
167107 if ( event . type === 'start' ) {
@@ -173,4 +113,4 @@ describe('nodemon fork', function () {
173113 }
174114 } ) ;
175115 } ) ;
176- } ) ;
116+ } ) ;
0 commit comments