This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
project.js
85 lines (76 loc) · 2.07 KB
/
project.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var test = require('tap').test
var npmconf = require('../npmconf.js')
var common = require('./00-setup.js')
var path = require('path')
var fix = path.resolve(__dirname, 'fixtures')
var projectRc = path.resolve(fix, '.npmrc')
var projectData = { just: 'testing' }
var ucData =
{ globalconfig: common.globalconfig,
email: 'i@izs.me',
'env-thing': 'asdf',
'init.author.name': 'Isaac Z. Schlueter',
'init.author.email': 'i@izs.me',
'init.author.url': 'http://blog.izs.me/',
'proprietary-attribs': false,
'npm:publishtest': true,
'_npmjs.org:couch': 'https://admin:password@localhost:5984/registry',
_auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=',
'npm-www:nocache': '1',
nodedir: '/Users/isaacs/dev/js/node-v0.8',
'sign-git-tag': true,
message: 'v%s',
'strict-ssl': false,
'tmp': process.env.HOME + '/.tmp',
username : "username",
_password : "password",
_token:
{ AuthSession: 'yabba-dabba-doodle',
version: '1',
expires: '1345001053415',
path: '/',
httponly: true } }
var envData = common.envData
var envDataFix = common.envDataFix
var gcData = { 'package-config:foo': 'boo' }
var biData = {}
var cli = { foo: 'bar', umask: 022, prefix: fix }
var expectList =
[ cli,
envDataFix,
projectData,
ucData,
gcData,
biData ]
var expectSources =
{ cli: { data: cli },
env:
{ data: envDataFix,
source: envData,
prefix: '' },
project:
{ path: projectRc,
type: 'ini',
data: projectData },
user:
{ path: common.userconfig,
type: 'ini',
data: ucData },
global:
{ path: common.globalconfig,
type: 'ini',
data: gcData },
builtin: { data: biData } }
test('no builtin', function (t) {
npmconf.load(cli, function (er, conf) {
if (er) throw er
t.same(conf.list, expectList)
t.same(conf.sources, expectSources)
t.same(npmconf.rootConf.list, [])
t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
t.equal(conf.root, npmconf.defs.defaults)
t.equal(conf.get('umask'), 022)
t.equal(conf.get('heading'), 'npm')
t.end()
})
})