Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-10 01:14:32 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:11 +0300
commit950ed58cca69a525f2cb4ce5db9a49967a526b7e (patch)
treeb2f647f32ec8290fe825358b25bd033a0f0e080a /node_modules/node-gyp/test/test-find-python.js
parent006914514b3625165d8e1857965dcbf3b8031e3f (diff)
node-gyp@3.6.1
Diffstat (limited to 'node_modules/node-gyp/test/test-find-python.js')
-rw-r--r--node_modules/node-gyp/test/test-find-python.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/node_modules/node-gyp/test/test-find-python.js b/node_modules/node-gyp/test/test-find-python.js
index 30ba6df78..2d9f171c5 100644
--- a/node_modules/node-gyp/test/test-find-python.js
+++ b/node_modules/node-gyp/test/test-find-python.js
@@ -1,6 +1,7 @@
'use strict'
var test = require('tape')
+var path = require('path')
var configure = require('../lib/configure')
var execFile = require('child_process').execFile
var PythonFinder = configure.test.PythonFinder
@@ -34,10 +35,19 @@ function poison(object, property) {
Object.defineProperty(object, property, descriptor)
}
+// Work around a v0.10.x CI issue where path.resolve() on UNIX systems prefixes
+// Windows paths with the current working directory. v0.12 and up are free of
+// this issue because they use path.win32.resolve() which does the right thing.
+var resolve = path.win32 && path.win32.resolve || function() {
+ function rstrip(s) { return s.replace(/\\+$/, '') }
+ return [].slice.call(arguments).map(rstrip).join('\\')
+}
+
function TestPythonFinder() { PythonFinder.apply(this, arguments) }
TestPythonFinder.prototype = Object.create(PythonFinder.prototype)
poison(TestPythonFinder.prototype, 'env')
poison(TestPythonFinder.prototype, 'execFile')
+poison(TestPythonFinder.prototype, 'resolve')
poison(TestPythonFinder.prototype, 'stat')
poison(TestPythonFinder.prototype, 'which')
poison(TestPythonFinder.prototype, 'win')
@@ -287,6 +297,7 @@ test('find python - no python, no python launcher, good guess', function (t) {
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
}
+ f.resolve = resolve
f.stat = function(path, cb) {
t.ok(re.test(path))
cb(null, {})
@@ -313,6 +324,7 @@ test('find python - no python, no python launcher, bad guess', function (t) {
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
}
+ f.resolve = resolve
f.stat = function(path, cb) {
t.ok(/Z:[\\\/]Python27[\\\/]python.exe/.test(path))
var err = new Error('not found')