mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
Sync deps and engines with npm (#2770)
* feat!: update `engines.node` to `^14.17.0 || ^16.13.0 || >=18.0.0` * deps: nopt@^7.0.0 * feat: replace npmlog with proc-log * deps: standard@17.0.0 and fix linting errors * deps: which@3.0.0 - this also promiisifies the build command * deps: glob@8.0.3 * feat: drop rimraf dependency * fix: use fs/promises in favor of fs.promises
This commit is contained in:
parent
33391db3a0
commit
192eec2aca
27 changed files with 536 additions and 418 deletions
|
@ -5,6 +5,7 @@ const assert = require('assert')
|
|||
const path = require('path')
|
||||
const devDir = require('./common').devDir()
|
||||
const gyp = require('../lib/node-gyp')
|
||||
const log = require('../lib/log')
|
||||
const requireInject = require('require-inject')
|
||||
const configure = requireInject('../lib/configure', {
|
||||
'graceful-fs': {
|
||||
|
@ -21,17 +22,17 @@ const configure = requireInject('../lib/configure', {
|
|||
}
|
||||
})
|
||||
|
||||
log.logger.stream = null
|
||||
|
||||
const EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib')
|
||||
const SEPARATOR = process.platform === 'win32' ? ';' : ':'
|
||||
const SPAWN_RESULT = cb => ({ on: function () { cb() } })
|
||||
|
||||
require('npmlog').level = 'warn'
|
||||
|
||||
describe('configure-python', function () {
|
||||
it('configure PYTHONPATH with no existing env', function (done) {
|
||||
delete process.env.PYTHONPATH
|
||||
|
||||
var prog = gyp()
|
||||
const prog = gyp()
|
||||
prog.parseArgv([])
|
||||
prog.spawn = function () {
|
||||
assert.strictEqual(process.env.PYTHONPATH, EXPECTED_PYPATH)
|
||||
|
@ -42,15 +43,15 @@ describe('configure-python', function () {
|
|||
})
|
||||
|
||||
it('configure PYTHONPATH with existing env of one dir', function (done) {
|
||||
var existingPath = path.join('a', 'b')
|
||||
const existingPath = path.join('a', 'b')
|
||||
process.env.PYTHONPATH = existingPath
|
||||
|
||||
var prog = gyp()
|
||||
const prog = gyp()
|
||||
prog.parseArgv([])
|
||||
prog.spawn = function () {
|
||||
assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
|
||||
|
||||
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
|
||||
const dirs = process.env.PYTHONPATH.split(SEPARATOR)
|
||||
assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, existingPath])
|
||||
|
||||
return SPAWN_RESULT(done)
|
||||
|
@ -60,17 +61,17 @@ describe('configure-python', function () {
|
|||
})
|
||||
|
||||
it('configure PYTHONPATH with existing env of multiple dirs', function (done) {
|
||||
var pythonDir1 = path.join('a', 'b')
|
||||
var pythonDir2 = path.join('b', 'c')
|
||||
var existingPath = [pythonDir1, pythonDir2].join(SEPARATOR)
|
||||
const pythonDir1 = path.join('a', 'b')
|
||||
const pythonDir2 = path.join('b', 'c')
|
||||
const existingPath = [pythonDir1, pythonDir2].join(SEPARATOR)
|
||||
process.env.PYTHONPATH = existingPath
|
||||
|
||||
var prog = gyp()
|
||||
const prog = gyp()
|
||||
prog.parseArgv([])
|
||||
prog.spawn = function () {
|
||||
assert.strictEqual(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
|
||||
|
||||
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
|
||||
const dirs = process.env.PYTHONPATH.split(SEPARATOR)
|
||||
assert.deepStrictEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2])
|
||||
|
||||
return SPAWN_RESULT(done)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue