@@ -4,6 +4,7 @@ var path = require('path')
44var mkdirp = require ( 'mkdirp' )
55var osenv = require ( 'osenv' )
66var rimraf = require ( 'rimraf' )
7+ var which = require ( 'which' )
78var test = require ( 'tap' ) . test
89
910var common = require ( '../common-tap.js' )
@@ -21,6 +22,9 @@ if (isWindows) {
2122 PATH = '/bin:/usr/bin'
2223}
2324
25+ var systemNode = which . sync ( 'node' , { nothrow : true , path : PATH } )
26+ // the path to the system wide node (null if none)
27+
2428test ( 'setup' , function ( t ) {
2529 cleanup ( )
2630 mkdirp . sync ( pkg )
@@ -183,6 +187,12 @@ function checkPath (testconfig, t) {
183187 'The node binary used for scripts is.*' +
184188 process . execPath . replace ( / [ / \\ ] / g, '.' ) )
185189 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' )
186196 } else {
187197 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' )
188198 }
0 commit comments