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.
 
 
 
 
 
 

29 lines
797 B

var test = require("tap").test
, fs = require("fs")
, path = require("path")
, existsSync = fs.existsSync || path.existsSync
, npm = require("../../")
, rimraf = require("rimraf")
test("dedupe finds the common module and moves it up one level", function (t) {
t.plan(1)
setup(function () {
npm.install(".", function (err) {
if (err) return t.fail(err)
npm.dedupe(function(err) {
if (err) return t.fail(err)
t.ok(existsSync(path.join(__dirname, "dedupe", "node_modules", "minimist")))
})
})
})
})
function setup (cb) {
process.chdir(path.join(__dirname, "dedupe"))
npm.load(function () {
rimraf.sync(path.join(__dirname, "dedupe", "node_modules"))
fs.mkdirSync(path.join(__dirname, "dedupe", "node_modules"))
cb()
})
}