13
13
14
14
var cp = require ( 'child_process' ) ;
15
15
var fs = require ( 'fs' ) ;
16
+ var path = require ( 'path' ) ;
16
17
var stripJsonComments = require ( 'strip-json-comments' ) ;
17
18
18
19
var testEntry = 'test' ;
45
46
{
46
47
if ( fs . statSync ( './.npmscriptrc.js' ) . isFile ( ) )
47
48
{
48
- configInfo = require ( './.npmscriptrc.js' ) ;
49
+ configInfo = require ( path . resolve ( './.npmscriptrc.js' ) ) ;
49
50
}
50
51
}
51
- catch ( err ) { /* nop */ }
52
-
53
- // Attempt to load `.npmscriptrc` and strip comments.
54
- /* istanbul ignore next */
55
- try
52
+ catch ( err )
56
53
{
57
- if ( fs . statSync ( './.npmscriptrc' ) . isFile ( ) )
54
+ // Attempt to load `.npmscriptrc` and strip comments.
55
+ /* istanbul ignore next */
56
+ try
58
57
{
59
- configInfo = JSON . parse ( stripJsonComments ( fs . readFileSync ( './.npmscriptrc' , 'utf-8' ) ) ) ;
58
+ if ( fs . statSync ( './.npmscriptrc' ) . isFile ( ) )
59
+ {
60
+ configInfo = JSON . parse ( stripJsonComments ( fs . readFileSync ( './.npmscriptrc' , 'utf-8' ) ) ) ;
61
+ }
60
62
}
63
+ catch ( err ) { /* nop */ }
61
64
}
62
- catch ( err ) { /* nop */ }
63
65
64
66
// Exit now if no configInfo object has been loaded.
65
67
if ( typeof configInfo !== 'object' )
@@ -113,4 +115,4 @@ exec += ' ' + testConfig.mocha.source;
113
115
114
116
// Notify what command is being executed then execute it.
115
117
process . stdout . write ( 'Executing: ' + exec + '\n' ) ;
116
- cp . execSync ( exec , { stdio : 'inherit' } ) ;
118
+ cp . execSync ( exec , { stdio : 'inherit' } ) ;
0 commit comments