@@ -12,7 +12,10 @@ describe('options', function () {
1212
1313 it ( 'should fail synchronous specs' , function ( done ) {
1414 run ( 'options/async-only-sync.fixture.js' , args , function ( err , res ) {
15- assert ( ! err ) ;
15+ if ( err ) {
16+ done ( err ) ;
17+ return ;
18+ }
1619 assert . equal ( res . stats . pending , 0 ) ;
1720 assert . equal ( res . stats . passes , 0 ) ;
1821 assert . equal ( res . stats . failures , 1 ) ;
@@ -25,7 +28,10 @@ describe('options', function () {
2528
2629 it ( 'should allow asynchronous specs' , function ( done ) {
2730 run ( 'options/async-only-async.fixture.js' , args , function ( err , res ) {
28- assert ( ! err ) ;
31+ if ( err ) {
32+ done ( err ) ;
33+ return ;
34+ }
2935 assert . equal ( res . stats . pending , 0 ) ;
3036 assert . equal ( res . stats . passes , 1 ) ;
3137 assert . equal ( res . stats . failures , 0 ) ;
@@ -44,7 +50,10 @@ describe('options', function () {
4450
4551 it ( 'should stop after the first error' , function ( done ) {
4652 run ( 'options/bail.fixture.js' , args , function ( err , res ) {
47- assert ( ! err ) ;
53+ if ( err ) {
54+ done ( err ) ;
55+ return ;
56+ }
4857 assert . equal ( res . stats . pending , 0 ) ;
4958 assert . equal ( res . stats . passes , 1 ) ;
5059 assert . equal ( res . stats . failures , 1 ) ;
@@ -64,7 +73,10 @@ describe('options', function () {
6473
6574 it ( 'should sort tests in alphabetical order' , function ( done ) {
6675 run ( 'options/sort*' , args , function ( err , res ) {
67- assert ( ! err ) ;
76+ if ( err ) {
77+ done ( err ) ;
78+ return ;
79+ }
6880 assert . equal ( res . stats . pending , 0 ) ;
6981 assert . equal ( res . stats . passes , 2 ) ;
7082 assert . equal ( res . stats . failures , 0 ) ;
@@ -84,7 +96,10 @@ describe('options', function () {
8496
8597 it ( 'should run the generated test suite' , function ( done ) {
8698 run ( 'options/delay.fixture.js' , args , function ( err , res ) {
87- assert ( ! err ) ;
99+ if ( err ) {
100+ done ( err ) ;
101+ return ;
102+ }
88103 assert . equal ( res . stats . pending , 0 ) ;
89104 assert . equal ( res . stats . passes , 1 ) ;
90105 assert . equal ( res . stats . failures , 0 ) ;
@@ -98,7 +113,10 @@ describe('options', function () {
98113
99114 it ( 'should throw an error if the test suite failed to run' , function ( done ) {
100115 run ( 'options/delay-fail.fixture.js' , args , function ( err , res ) {
101- assert ( ! err ) ;
116+ if ( err ) {
117+ done ( err ) ;
118+ return ;
119+ }
102120 assert . equal ( res . stats . pending , 0 ) ;
103121 assert . equal ( res . stats . passes , 0 ) ;
104122 assert . equal ( res . stats . failures , 1 ) ;
@@ -115,7 +133,10 @@ describe('options', function () {
115133 it ( 'runs specs matching a string' , function ( done ) {
116134 args = [ '--grep' , 'match' ] ;
117135 run ( 'options/grep.fixture.js' , args , function ( err , res ) {
118- assert ( ! err ) ;
136+ if ( err ) {
137+ done ( err ) ;
138+ return ;
139+ }
119140 assert . equal ( res . stats . pending , 0 ) ;
120141 assert . equal ( res . stats . passes , 2 ) ;
121142 assert . equal ( res . stats . failures , 0 ) ;
@@ -128,7 +149,10 @@ describe('options', function () {
128149 it ( 'with RegExp like strings(pattern follow by flag)' , function ( done ) {
129150 args = [ '--grep' , '/match/i' ] ;
130151 run ( 'options/grep.fixture.js' , args , function ( err , res ) {
131- assert ( ! err ) ;
152+ if ( err ) {
153+ done ( err ) ;
154+ return ;
155+ }
132156 assert . equal ( res . stats . pending , 0 ) ;
133157 assert . equal ( res . stats . passes , 4 ) ;
134158 assert . equal ( res . stats . failures , 0 ) ;
@@ -140,7 +164,10 @@ describe('options', function () {
140164 it ( 'string as pattern' , function ( done ) {
141165 args = [ '--grep' , '.*' ] ;
142166 run ( 'options/grep.fixture.js' , args , function ( err , res ) {
143- assert ( ! err ) ;
167+ if ( err ) {
168+ done ( err ) ;
169+ return ;
170+ }
144171 assert . equal ( res . stats . pending , 0 ) ;
145172 assert . equal ( res . stats . passes , 4 ) ;
146173 assert . equal ( res . stats . failures , 1 ) ;
@@ -154,7 +181,10 @@ describe('options', function () {
154181 it ( 'runs specs that do not match the pattern' , function ( done ) {
155182 args = [ '--grep' , 'fail' , '--invert' ] ;
156183 run ( 'options/grep.fixture.js' , args , function ( err , res ) {
157- assert ( ! err ) ;
184+ if ( err ) {
185+ done ( err ) ;
186+ return ;
187+ }
158188 assert . equal ( res . stats . pending , 0 ) ;
159189 assert . equal ( res . stats . passes , 4 ) ;
160190 assert . equal ( res . stats . failures , 0 ) ;
@@ -169,7 +199,10 @@ describe('options', function () {
169199 it ( 'retries after a certain threshold' , function ( done ) {
170200 args = [ '--retries' , '3' ] ;
171201 run ( 'options/retries.fixture.js' , args , function ( err , res ) {
172- assert ( ! err ) ;
202+ if ( err ) {
203+ done ( err ) ;
204+ return ;
205+ }
173206 assert . equal ( res . stats . pending , 0 ) ;
174207 assert . equal ( res . stats . passes , 0 ) ;
175208 assert . equal ( res . stats . tests , 1 ) ;
@@ -188,15 +221,21 @@ describe('options', function () {
188221
189222 it ( 'succeeds if there are only passed tests' , function ( done ) {
190223 run ( 'options/forbid-only/passed.js' , args , function ( err , res ) {
191- assert ( ! err ) ;
224+ if ( err ) {
225+ done ( err ) ;
226+ return ;
227+ }
192228 assert . equal ( res . code , 0 ) ;
193229 done ( ) ;
194230 } ) ;
195231 } ) ;
196232
197233 it ( 'fails if there are tests marked only' , function ( done ) {
198234 run ( 'options/forbid-only/only.js' , args , function ( err , res ) {
199- assert ( ! err ) ;
235+ if ( err ) {
236+ done ( err ) ;
237+ return ;
238+ }
200239 assert . equal ( res . code , 1 ) ;
201240 done ( ) ;
202241 } ) ;
@@ -210,23 +249,32 @@ describe('options', function () {
210249
211250 it ( 'succeeds if there are only passed tests' , function ( done ) {
212251 run ( 'options/forbid-pending/passed.js' , args , function ( err , res ) {
213- assert ( ! err ) ;
252+ if ( err ) {
253+ done ( err ) ;
254+ return ;
255+ }
214256 assert . equal ( res . code , 0 ) ;
215257 done ( ) ;
216258 } ) ;
217259 } ) ;
218260
219261 it ( 'fails if there are tests marked skip' , function ( done ) {
220262 run ( 'options/forbid-pending/skip.js' , args , function ( err , res ) {
221- assert ( ! err ) ;
263+ if ( err ) {
264+ done ( err ) ;
265+ return ;
266+ }
222267 assert . equal ( res . code , 1 ) ;
223268 done ( ) ;
224269 } ) ;
225270 } ) ;
226271
227272 it ( 'fails if there are pending tests' , function ( done ) {
228273 run ( 'options/forbid-pending/pending.js' , args , function ( err , res ) {
229- assert ( ! err ) ;
274+ if ( err ) {
275+ done ( err ) ;
276+ return ;
277+ }
230278 assert . equal ( res . code , 1 ) ;
231279 done ( ) ;
232280 } ) ;
0 commit comments