mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 17:51:35 +00:00

PR-URL: https://github.com/nodejs/node/pull/5369 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
var test = require('tap').test
|
|
var npm = require('../../')
|
|
var lifecycle = require('../../lib/utils/lifecycle')
|
|
|
|
test('lifecycle: make env correctly', function (t) {
|
|
npm.load({enteente: Infinity}, function () {
|
|
var env = lifecycle.makeEnv({}, null, process.env)
|
|
|
|
t.equal('Infinity', env.npm_config_enteente)
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('lifecycle : accepts wd for package that matches project\'s name', function (t) {
|
|
npm.load({}, function () {
|
|
var wd = '/opt/my-time/node_modules/time'
|
|
var pkg = {name: 'time'}
|
|
|
|
t.equal(lifecycle._incorrectWorkingDirectory(wd, pkg), false)
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('lifecycle : accepts wd for package that doesn\'t match project\'s name', function (t) {
|
|
npm.load({}, function () {
|
|
var wd = '/opt/my-project/node_modules/time'
|
|
var pkg = {name: 'time'}
|
|
|
|
t.equal(lifecycle._incorrectWorkingDirectory(wd, pkg), false)
|
|
t.end()
|
|
})
|
|
})
|
|
|
|
test('lifecycle : rejects wd for ', function (t) {
|
|
npm.load({}, function () {
|
|
var wd = '/opt/my-time/node_modules/time/invalid'
|
|
var pkg = {
|
|
name: 'time'
|
|
}
|
|
|
|
t.equal(lifecycle._incorrectWorkingDirectory(wd, pkg), true)
|
|
t.end()
|
|
})
|
|
})
|