@@ -4,20 +4,39 @@ var path = require('path');
44var loadOptions = require ( '../../lib/cli/options' ) . loadOptions ;
55
66describe ( 'options' , function ( ) {
7- it ( 'Should support extended options' , function ( ) {
8- var configDir = path . join (
9- __dirname ,
10- 'fixtures' ,
11- 'config' ,
12- 'mocharc-extended'
13- ) ;
7+ var workingDirectory ;
8+ const workspaceDir = path . join (
9+ __dirname ,
10+ 'fixtures' ,
11+ 'config' ,
12+ 'mocharc-extended'
13+ ) ;
14+
15+ beforeEach ( function ( ) {
16+ workingDirectory = process . cwd ( ) ;
17+ process . chdir ( workspaceDir ) ;
18+ } ) ;
19+
20+ afterEach ( function ( ) {
21+ process . chdir ( workingDirectory ) ;
22+ } ) ;
23+
24+ it ( 'Should support extended options using --config parameter' , function ( ) {
1425 var extended = loadOptions ( [
1526 '--config' ,
16- path . join ( configDir , 'extends.json' )
27+ path . join ( workspaceDir , 'extends.json' )
1728 ] ) ;
1829 expect ( extended . require , 'to equal' , [ 'foo' , 'bar' ] ) ;
1930 expect ( extended . bail , 'to equal' , true ) ;
2031 expect ( extended . reporter , 'to equal' , 'html' ) ;
2132 expect ( extended . slow , 'to equal' , 30 ) ;
2233 } ) ;
34+
35+ it ( 'Should support extended options using rc file' , function ( ) {
36+ var extended = loadOptions ( [ ] ) ;
37+ expect ( extended . require , 'to equal' , [ 'foo' , 'bar' ] ) ;
38+ expect ( extended . bail , 'to equal' , true ) ;
39+ expect ( extended . reporter , 'to equal' , 'html' ) ;
40+ expect ( extended . slow , 'to equal' , 30 ) ;
41+ } ) ;
2342} ) ;
0 commit comments