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
@@ -232,4 +235,28 @@ describe('options', function () {
232235 } ) ;
233236 } ) ;
234237 } ) ;
238+
239+ 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 ) { }
249+ try {
250+ fs . unlinkSync ( path . resolve ( __dirname , 'test-env/test/mocha.opts' ) ) ;
251+ } catch ( e ) { }
252+ try {
253+ fs . rmdirSync ( path . resolve ( __dirname , 'test-env/test' ) ) ;
254+ } catch ( e ) { }
255+ try {
256+ fs . rmdirSync ( path . resolve ( __dirname , 'test-env' ) ) ;
257+ } catch ( e ) { }
258+ assert ( output . indexOf ( 'Usage:' ) >= 0 ) ;
259+ done ( ) ;
260+ } ) ;
261+ } ) ;
235262} ) ;
You can’t perform that action at this time.
0 commit comments