1var test = require('tap').test 2var path = require('path') 3var fix = path.resolve(__dirname, '..', 'fixtures', 'config') 4var projectRc = path.resolve(fix, '.npmrc') 5var npmconf = require('../../lib/config/core.js') 6var common = require('../common-config.js') 7 8var projectData = { just: 'testing' } 9 10var ucData = common.ucData 11var envData = common.envData 12var envDataFix = common.envDataFix 13 14var gcData = { 'package-config:foo': 'boo' } 15 16var biData = {} 17 18var cli = { foo: 'bar', umask: parseInt('022', 8), prefix: fix } 19 20var expectList = [ 21 cli, 22 envDataFix, 23 projectData, 24 ucData, 25 gcData, 26 biData 27] 28 29var expectSources = { 30 cli: { data: cli }, 31 env: { 32 data: envDataFix, 33 source: envData, 34 prefix: '' 35 }, 36 project: { 37 path: projectRc, 38 type: 'ini', 39 data: projectData 40 }, 41 user: { 42 path: common.userconfig, 43 type: 'ini', 44 data: ucData 45 }, 46 global: { 47 path: common.globalconfig, 48 type: 'ini', 49 data: gcData 50 }, 51 builtin: { data: biData } 52} 53 54test('no builtin', function (t) { 55 npmconf.load(cli, function (er, conf) { 56 if (er) throw er 57 t.same(conf.list, expectList) 58 t.same(conf.sources, expectSources) 59 t.same(npmconf.rootConf.list, []) 60 t.equal(npmconf.rootConf.root, npmconf.defs.defaults) 61 t.equal(conf.root, npmconf.defs.defaults) 62 t.equal(conf.get('umask'), parseInt('022', 8)) 63 t.equal(conf.get('heading'), 'npm') 64 t.end() 65 }) 66}) 67