diff options
author | erik wienhold <git@ewie.name> | 2015-04-11 17:34:53 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2015-04-11 20:58:53 +0300 |
commit | b0273190c71eba14395ddfdd1d9f7ba625297523 (patch) | |
tree | 72cf63527274dc0ba59056e6ed3323f3ecbc2d53 /test | |
parent | 15efe124753257728a0ddc64074fa5a4b9c2eb30 (diff) |
install: scoped packages with peerDependencies
Package scopes cause an additional level in the tree structure which
must be considered when resolving the target folders of a package's
peerDependencies.
Fixes #7454.
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/install-scoped-with-peer-dependency.js | 32 | ||||
-rw-r--r-- | test/tap/install-scoped-with-peer-dependency/package/package.json | 7 |
2 files changed, 39 insertions, 0 deletions
diff --git a/test/tap/install-scoped-with-peer-dependency.js b/test/tap/install-scoped-with-peer-dependency.js new file mode 100644 index 000000000..e546719d9 --- /dev/null +++ b/test/tap/install-scoped-with-peer-dependency.js @@ -0,0 +1,32 @@ +var common = require("../common-tap.js") +var test = require("tap").test +var path = require("path") +var fs = require("fs") +var rimraf = require("rimraf") +var mkdirp = require("mkdirp") +var pkg = path.join(__dirname, "install-scoped-with-peer-dependency") + +var EXEC_OPTS = { } + +test("setup", function (t) { + mkdirp.sync(pkg) + mkdirp.sync(path.resolve(pkg, "node_modules")) + process.chdir(pkg) + t.end() +}) + +test("it should install peerDependencies in same tree level as the parent package", function(t) { + common.npm(["install", "./package"], EXEC_OPTS, function(err, code) { + var p = path.resolve(pkg, "node_modules/underscore/package.json") + t.ifError(err, "install local package successful") + t.equal(code, 0, "npm install exited with code") + t.ok(JSON.parse(fs.readFileSync(p, "utf8"))) + t.end() + }) +}) + +test("cleanup", function(t) { + process.chdir(__dirname) + rimraf.sync(path.resolve(pkg, "node_modules")) + t.end() +}) diff --git a/test/tap/install-scoped-with-peer-dependency/package/package.json b/test/tap/install-scoped-with-peer-dependency/package/package.json new file mode 100644 index 000000000..77e6b128c --- /dev/null +++ b/test/tap/install-scoped-with-peer-dependency/package/package.json @@ -0,0 +1,7 @@ +{ + "name": "@scope/package", + "version": "0.0.0", + "peerDependencies": { + "underscore": "*" + } +} |