You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
958 B

11 years ago
var test = require("tap").test
, npm = require("../../")
, rimraf = require("rimraf")
, mr = require("npm-registry-mock")
, common = require("../common-tap.js")
, pkg = __dirname + "/uninstall-package"
11 years ago
test("returns a list of removed items", function (t) {
t.plan(1)
mr(common.port, function (s) {
setup(function () {
npm.install(".", function (err) {
11 years ago
if (err) return t.fail(err)
npm.uninstall("underscore", "request", "lala", function (err, d) {
if (err) return t.fail(err)
t.same(d.sort(), ["underscore", "request"].sort())
s.close()
t.end()
})
11 years ago
})
})
})
})
test("cleanup", function (t) {
cleanup()
t.end()
})
11 years ago
function setup (cb) {
cleanup()
process.chdir(pkg)
npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
11 years ago
cb()
})
}
function cleanup () {
rimraf.sync(pkg + "/node_modules")
rimraf.sync(pkg + "/cache")
}