@@ -18,8 +18,8 @@ function guessCWD (cwd) {
18
18
return cwd
19
19
}
20
20
21
- function loadConfig ( argv , cwd ) {
22
- const rcPath = findUp . sync ( [ '.nycrc' , '.nycrc.json' ] , { cwd : cwd } )
21
+ Config . loadConfig = function ( argv , cwd ) {
22
+ const rcPath = findUp . sync ( [ argv . nycrcPath || '.nycrc' , '.nycrc.json' ] , { cwd : guessCWD ( cwd ) } )
23
23
let config = { }
24
24
25
25
if ( rcPath ) {
@@ -40,7 +40,6 @@ function loadConfig (argv, cwd) {
40
40
// that would cause the application to exit early.
41
41
Config . buildYargs = function ( cwd ) {
42
42
cwd = guessCWD ( cwd )
43
- const config = loadConfig ( )
44
43
return Yargs ( [ ] )
45
44
. usage ( '$0 [command] [options]' )
46
45
. usage ( '$0 [options] [bin-to-instrument]' )
@@ -196,6 +195,11 @@ Config.buildYargs = function (cwd) {
196
195
type : 'boolean' ,
197
196
global : false
198
197
} )
198
+ . option ( 'nycrc-path' , {
199
+ default : '.nycrc' ,
200
+ description : 'specify a different .nycrc path' ,
201
+ global : false
202
+ } )
199
203
. option ( 'temp-directory' , {
200
204
describe : 'directory to output raw coverage information to' ,
201
205
default : './.nyc_output' ,
@@ -208,7 +212,6 @@ Config.buildYargs = function (cwd) {
208
212
. epilog ( 'visit https://git.io/vHysA for list of available reporters' )
209
213
. boolean ( 'h' )
210
214
. boolean ( 'version' )
211
- . config ( config )
212
215
. help ( false )
213
216
. version ( false )
214
217
}
0 commit comments