1 require('./00-config-setup.js')
3 var path = require('path')
4 var fs = require('graceful-fs')
5 var test = require('tap').test
6 var mkdirp = require('mkdirp')
7 var rimraf = require('rimraf')
8 var osenv = require('osenv')
9 var npmconf = require('../../lib/config/core.js')
11 var dir = path.resolve(__dirname, 'config-new-cafile')
12 var beep = path.resolve(dir, 'beep.pem')
14 test('setup', function (t) {
19 test('can set new cafile when old is gone', function (t) {
21 npmconf.load(function (error, conf) {
22 npmconf.loaded = false
24 conf.set('cafile', beep, 'user')
25 conf.save('user', function (error) {
27 t.equal(conf.get('cafile'), beep)
29 npmconf.load(function (error, conf) {
33 t.equal(conf.get('cafile'), beep)
35 conf.save('user', function (error) {
43 test('cleanup', function (t) {
48 function bootstrap () {
50 fs.writeFileSync(beep, '')
54 process.chdir(osenv.tmpdir())