Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/tap/dedupe.js')
-rw-r--r--test/tap/dedupe.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/tap/dedupe.js b/test/tap/dedupe.js
index 9a8b31a79..b4b7495aa 100644
--- a/test/tap/dedupe.js
+++ b/test/tap/dedupe.js
@@ -4,17 +4,19 @@ var test = require("tap").test
, existsSync = fs.existsSync || path.existsSync
, npm = require("../../")
, rimraf = require("rimraf")
+ , mr = require("npm-registry-mock")
+ , common = require('../common-tap.js')
test("dedupe finds the common module and moves it up one level", function (t) {
- t.plan(2)
-
- setup(function () {
+ setup(function (s) {
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")))
- t.ok(!existsSync(path.join(__dirname, "dedupe", "node_modules", "prime")))
+ t.ok(!existsSync(path.join(__dirname, "dedupe", "node_modules", "checker")))
+ s.close() // shutdown mock registry.
+ t.end()
})
})
})
@@ -22,9 +24,11 @@ test("dedupe finds the common module and moves it up one level", function (t) {
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()
+ mr(common.port, function (s) { // create mock registry.
+ npm.load({registry: common.registry}, function() {
+ rimraf.sync(path.join(__dirname, "dedupe", "node_modules"))
+ fs.mkdirSync(path.join(__dirname, "dedupe", "node_modules"))
+ cb(s)
+ })
})
}