diff options
Diffstat (limited to 'deps/npm/test/tap/owner.js')
-rw-r--r-- | deps/npm/test/tap/owner.js | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/deps/npm/test/tap/owner.js b/deps/npm/test/tap/owner.js index 4bef1a0d87..0be88284d9 100644 --- a/deps/npm/test/tap/owner.js +++ b/deps/npm/test/tap/owner.js @@ -1,11 +1,22 @@ var mr = require('npm-registry-mock') var test = require('tap').test +var path = require('path') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') var common = require('../common-tap.js') +var basedir = path.join(__dirname, path.basename(__filename, '.js')) +var cachedir = path.join(basedir, 'cache') var server -var EXEC_OPTS = {} +var EXEC_OPTS = { + cwd: basedir, + stdio: [0, 'pipe', 2], + env: common.newEnv().extend({ + npm_config_cache: cachedir + }) +} var jashkenas = { name: 'jashkenas', @@ -63,28 +74,18 @@ function mocks (server) { } test('setup', function (t) { - common.npm( - [ - '--loglevel', 'silent', - 'cache', 'clean' - ], - EXEC_OPTS, - function (err, code) { - t.ifError(err, 'npm cache clean ran without error') - t.notOk(code, 'npm cache clean exited cleanly') - - mr({ port: common.port, plugin: mocks }, function (er, s) { - server = s - t.end() - }) - } - ) + cleanup() + mkdirp.sync(cachedir) + mr({ port: common.port, plugin: mocks }, function (er, s) { + server = s + t.end() + }) }) test('npm owner add', function (t) { common.npm( [ - '--loglevel', 'silent', + '--loglevel', 'warn', '--registry', common.registry, 'owner', 'add', 'othiym23', 'underscore' ], @@ -159,5 +160,10 @@ test('npm owner rm', function (t) { test('cleanup', function (t) { server.close() + cleanup() t.end() }) + +function cleanup () { + rimraf.sync(basedir) +} |