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.

43 lines
1007 B

11 years ago
var test = require("tap").test
, npm = require("../../")
, rimraf = require("rimraf")
, mr = require("npm-registry-mock")
, common = require("../common-tap.js")
, path = require("path")
, pkg = path.join(__dirname, "uninstall-package")
11 years ago
test("returns a list of removed items", function (t) {
t.plan(1)
mr({port : common.port}, function (er, 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")
}