@@ -237,15 +237,17 @@ describe('options', function () {
237237 } ) ;
238238
239239 describe ( '--help' , function ( ) {
240- it ( 'works despite the presence of mocha.opts' , function ( done ) {
241- var output = '' ;
242- try {
243- fs . mkdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
244- fs . mkdirSync ( path . resolve ( __dirname , 'test-env/test' ) ) ;
245- fs . writeFileSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) , 'foo' ) ;
246- var mochaLoc = path . resolve ( __dirname , '../../bin/mocha' ) ;
247- output = '' + childProcess . execSync ( mochaLoc + ' -h' , { cwd : path . resolve ( __dirname , 'test-env' ) } ) ;
248- } catch ( e ) { }
240+ before ( function ( ) {
241+ fs . mkdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
242+ fs . mkdirSync ( path . resolve ( __dirname , 'test-env/test' ) ) ;
243+ fs . writeFileSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) , 'foo' ) ;
244+ } ) ;
245+ it ( 'works despite the presence of mocha.opts' , function ( ) {
246+ var mochaLoc = path . resolve ( __dirname , '../../bin/mocha' ) ;
247+ var output = '' + childProcess . execSync ( mochaLoc + ' -h' , { cwd : path . resolve ( __dirname , 'test-env' ) } ) ;
248+ expect ( output ) . to . contain ( 'Usage:' ) ;
249+ } ) ;
250+ after ( function ( ) {
249251 try {
250252 fs . unlinkSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) ) ;
251253 } catch ( e ) { }
@@ -255,8 +257,6 @@ describe('options', function () {
255257 try {
256258 fs . rmdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
257259 } catch ( e ) { }
258- assert ( output . indexOf ( 'Usage:' ) >= 0 ) ;
259- done ( ) ;
260260 } ) ;
261261 } ) ;
262262} ) ;
0 commit comments