1 var fs = require('graceful-fs')
2 var http = require('http')
3 var path = require('path')
5 var mkdirp = require('mkdirp')
6 var osenv = require('osenv')
7 var rimraf = require('rimraf')
8 var test = require('tap').test
10 var pkg = path.join(__dirname, 'npm-test-unpublish-config')
11 var fixturePath = path.join(pkg, 'fixture_npmrc')
13 var common = require('../common-tap.js')
16 name: 'npm-test-unpublish-config',
18 publishConfig: { registry: common.registry }
21 test('setup', function (t) {
25 path.join(pkg, 'package.json'),
26 JSON.stringify(json), 'utf8'
30 '//localhost:1337/:_authToken = beeeeeeeeeeeeef\n' +
31 'registry = http://lvh.me:4321/registry/path\n'
37 test('cursory test of unpublishing with config', function (t) {
40 http.createServer(function (req, res) {
41 t.pass('got request on the fakey fake registry')
44 res.end(JSON.stringify({
45 error: 'shh no tears, only dreams now'
48 }).listen(common.port, function () {
49 t.pass('server is listening')
53 '--userconfig', fixturePath,
54 '--loglevel', 'silent',
62 'npm_config_cache_lock_stale': 1000,
63 'npm_config_cache_lock_wait': 1000,
64 HOME: process.env.HOME,
65 Path: process.env.PATH,
66 PATH: process.env.PATH,
67 USERPROFILE: osenv.home()
70 function (err, code) {
71 t.ifError(err, 'publish command finished successfully')
72 t.notOk(code, 'npm install exited with code 0')
78 test('cleanup', function (t) {
79 process.chdir(osenv.tmpdir())