@@ -4,6 +4,7 @@ var path = require('path')
4
4
var mkdirp = require ( 'mkdirp' )
5
5
var osenv = require ( 'osenv' )
6
6
var rimraf = require ( 'rimraf' )
7
+ var which = require ( 'which' )
7
8
var test = require ( 'tap' ) . test
8
9
9
10
var common = require ( '../common-tap.js' )
@@ -21,6 +22,9 @@ if (isWindows) {
21
22
PATH = '/bin:/usr/bin'
22
23
}
23
24
25
+ var systemNode = which . sync ( 'node' , { nothrow : true , path : PATH } )
26
+ // the path to the system wide node (null if none)
27
+
24
28
test ( 'setup' , function ( t ) {
25
29
cleanup ( )
26
30
mkdirp . sync ( pkg )
@@ -183,6 +187,12 @@ function checkPath (testconfig, t) {
183
187
'The node binary used for scripts is.*' +
184
188
process . execPath . replace ( / [ / \\ ] / g, '.' ) )
185
189
t . match ( stderr , regex , 'reports the current binary vs conflicting' )
190
+ } else if ( systemNode !== null ) {
191
+ var regexSystemNode = new RegExp (
192
+ 'The node binary used for scripts is.*' +
193
+ systemNode . replace ( / [ / \\ ] / g, '.' )
194
+ )
195
+ t . match ( stderr , regexSystemNode , 'reports the system binary vs conflicting' )
186
196
} else {
187
197
t . match ( stderr , / t h e r e i s n o n o d e b i n a r y i n t h e c u r r e n t P A T H / , 'informs user that there is no node binary in PATH' )
188
198
}
0 commit comments