From ee46c5c6ee1074f05aec98e9134a2039c945d84c Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sun, 23 Jun 2019 15:31:52 +1000 Subject: [PATCH] test: configure proper devDir for invoking configure() test/test-configure-python.js downloads a fresh set of headers to the package directory each time. By setting to the default global cache dir we get to re-use cached headers and skip the download step. --- test/common.js | 3 +++ test/test-configure-python.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/common.js diff --git a/test/common.js b/test/common.js new file mode 100644 index 0000000000..b714ee2902 --- /dev/null +++ b/test/common.js @@ -0,0 +1,3 @@ +const envPaths = require('env-paths') + +module.exports.devDir = () => envPaths('node-gyp', { suffix: '' }).cache diff --git a/test/test-configure-python.js b/test/test-configure-python.js index 895e488ba8..7009a1fd60 100644 --- a/test/test-configure-python.js +++ b/test/test-configure-python.js @@ -2,6 +2,7 @@ var test = require('tap').test var path = require('path') +var devDir = require('./common').devDir() var gyp = require('../lib/node-gyp') var requireInject = require('require-inject') var configure = requireInject('../lib/configure', { @@ -30,6 +31,7 @@ test('configure PYTHONPATH with no existing env', function (t) { t.equal(process.env.PYTHONPATH, EXPECTED_PYPATH) return SPAWN_RESULT } + prog.devDir = devDir configure(prog, [], t.fail) }) @@ -42,7 +44,6 @@ test('configure PYTHONPATH with existing env of one dir', function (t) { var prog = gyp() prog.parseArgv([]) prog.spawn = function () { - t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) var dirs = process.env.PYTHONPATH.split(SEPARATOR) @@ -50,6 +51,7 @@ test('configure PYTHONPATH with existing env of one dir', function (t) { return SPAWN_RESULT } + prog.devDir = devDir configure(prog, [], t.fail) }) @@ -64,7 +66,6 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) { var prog = gyp() prog.parseArgv([]) prog.spawn = function () { - t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR)) var dirs = process.env.PYTHONPATH.split(SEPARATOR) @@ -72,5 +73,6 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) { return SPAWN_RESULT } + prog.devDir = devDir configure(prog, [], t.fail) })