1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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()
})
})
|