diff options
author | isaacs <i@izs.me> | 2013-02-06 05:39:11 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-02-06 05:42:49 +0400 |
commit | 3f67ce695968fc2068f273e01e8ce8d2e6bb7a2d (patch) | |
tree | 7752ada944769a32355bf83928e7dce7a87b8419 | |
parent | 2cc8d398747a803dcc2a3ef5f12467798324a6d4 (diff) |
install: Fix regression introduced in 4fdd3c5
-rw-r--r-- | lib/install.js | 18 | ||||
-rw-r--r-- | test/tap/peer-deps-invalid.js | 4 | ||||
-rw-r--r-- | test/tap/peer-deps-without-package-json.js | 4 |
3 files changed, 17 insertions, 9 deletions
diff --git a/lib/install.js b/lib/install.js index 4df0e4757..5f97dc43a 100644 --- a/lib/install.js +++ b/lib/install.js @@ -185,13 +185,14 @@ function findPeerInvalid (where, cb) { }) } -function findPeerInvalid_ (packageMap, fpiSeen) { +function findPeerInvalid_ (packageMap, fpiList) { + if (fpiList.indexOf(packageMap) !== -1) + return + + fpiList.push(packageMap) + for (var packageName in packageMap) { var pkg = packageMap[packageName] - if (fpiSeen.indexOf(pkg) !== -1) - return null - - fpiSeen.push(pkg) if (pkg.peerInvalid) { var peersDepending = {}; @@ -205,8 +206,11 @@ function findPeerInvalid_ (packageMap, fpiSeen) { return { name: pkg.name, peersDepending: peersDepending } } - if (pkg.dependencies) - return findPeerInvalid_(pkg.dependencies, fpiSeen) + if (pkg.dependencies) { + var invalid = findPeerInvalid_(pkg.dependencies, fpiList) + if (invalid) + return invalid + } } return null diff --git a/test/tap/peer-deps-invalid.js b/test/tap/peer-deps-invalid.js index c32587a0a..44b936766 100644 --- a/test/tap/peer-deps-invalid.js +++ b/test/tap/peer-deps-invalid.js @@ -10,13 +10,15 @@ test("installing dependencies that having conflicting peerDependencies", functio process.chdir(__dirname + "/peer-deps-invalid") npm.load(function () { - npm.install(".", function (err) { + npm.commands.install([], function (err) { if (!err) { t.fail("No error!") + process.exit(1) return } t.equal(err.code, "EPEERINVALID") + process.exit(0) }) }) }) diff --git a/test/tap/peer-deps-without-package-json.js b/test/tap/peer-deps-without-package-json.js index fd547ebc5..19b606403 100644 --- a/test/tap/peer-deps-without-package-json.js +++ b/test/tap/peer-deps-without-package-json.js @@ -6,7 +6,6 @@ var npm = require("../../") var peerDepsTestUrl = "https://gist.github.com/raw/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js" test("installing a peerDependencies-using package without a package.json present (GH-3049)", function (t) { - t.plan(2) rimraf.sync(__dirname + "/peer-deps-without-package-json/node_modules") fs.mkdirSync(__dirname + "/peer-deps-without-package-json/node_modules") @@ -17,11 +16,14 @@ test("installing a peerDependencies-using package without a package.json present if (err) { t.fail(err) t.end() + process.exit(1) return } t.ok(fs.existsSync(__dirname + "/peer-deps-without-package-json/node_modules/npm-test-peer-deps-file")) t.ok(fs.existsSync(__dirname + "/peer-deps-without-package-json/node_modules/dict")) + t.end() + process.exit(0) }) }) }) |