@@ -18,8 +18,8 @@ function guessCWD (cwd) {
1818 return cwd
1919}
2020
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 ) } )
2323 let config = { }
2424
2525 if ( rcPath ) {
@@ -40,7 +40,6 @@ function loadConfig (argv, cwd) {
4040// that would cause the application to exit early.
4141Config . buildYargs = function ( cwd ) {
4242 cwd = guessCWD ( cwd )
43- const config = loadConfig ( )
4443 return Yargs ( [ ] )
4544 . usage ( '$0 [command] [options]' )
4645 . usage ( '$0 [options] [bin-to-instrument]' )
@@ -196,6 +195,11 @@ Config.buildYargs = function (cwd) {
196195 type : 'boolean' ,
197196 global : false
198197 } )
198+ . option ( 'nycrc-path' , {
199+ default : '.nycrc' ,
200+ description : 'specify a different .nycrc path' ,
201+ global : false
202+ } )
199203 . option ( 'temp-directory' , {
200204 describe : 'directory to output raw coverage information to' ,
201205 default : './.nyc_output' ,
@@ -208,7 +212,6 @@ Config.buildYargs = function (cwd) {
208212 . epilog ( 'visit https://git.io/vHysA for list of available reporters' )
209213 . boolean ( 'h' )
210214 . boolean ( 'version' )
211- . config ( config )
212215 . help ( false )
213216 . version ( false )
214217}
0 commit comments