Skip to content

Commit b6df091

Browse files
Olivier Chevetisaacs
Olivier Chevet
authored andcommitted
test: Proper handing of /usr/bin/node lifecycle-path test
PR-URL: #228 Credit: @olivr70 Close: #228 Reviewed-by: @isaacs
1 parent 82f8e17 commit b6df091

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/broken-under-nyc-and-travis/lifecycle-path.js

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var path = require('path')
44
var mkdirp = require('mkdirp')
55
var osenv = require('osenv')
66
var rimraf = require('rimraf')
7+
var which = require('which')
78
var test = require('tap').test
89

910
var 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+
2428
test('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, /there is no node binary in the current PATH/, 'informs user that there is no node binary in PATH')
188198
}

0 commit comments

Comments
 (0)