File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33var assert = require ( 'assert' ) ;
4+ var childProcess = require ( 'child_process' ) ;
5+ var fs = require ( 'fs' ) ;
6+ var path = require ( 'path' ) ;
47var run = require ( './helpers' ) . runMochaJSON ;
58var args = [ ] ;
69
@@ -180,4 +183,28 @@ describe('options', function () {
180183 } ) ;
181184 } ) ;
182185 } ) ;
186+
187+ describe ( '--help' , function ( ) {
188+ it ( 'works despite the presence of mocha.opts' , function ( done ) {
189+ var output = '' ;
190+ try {
191+ fs . mkdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
192+ fs . mkdirSync ( path . resolve ( __dirname , 'test-env/test' ) ) ;
193+ fs . writeFileSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) , 'foo' ) ;
194+ var mochaLoc = path . resolve ( __dirname , '../../bin/mocha' ) ;
195+ output = '' + childProcess . execSync ( mochaLoc + ' -h' , { cwd : path . resolve ( __dirname , 'test-env' ) } ) ;
196+ } catch ( e ) { }
197+ try {
198+ fs . unlinkSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) ) ;
199+ } catch ( e ) { }
200+ try {
201+ fs . rmdirSync ( path . resolve ( __dirname , 'test-env/test' ) ) ;
202+ } catch ( e ) { }
203+ try {
204+ fs . rmdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
205+ } catch ( e ) { }
206+ assert ( output . indexOf ( 'Usage:' ) >= 0 ) ;
207+ done ( ) ;
208+ } ) ;
209+ } ) ;
183210} ) ;
You can’t perform that action at this time.
0 commit comments