This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
}) |
7 changes: 7 additions & 0 deletions
7
test/tap/install-scoped-with-peer-dependency/package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@scope/package", | ||
"version": "0.0.0", | ||
"peerDependencies": { | ||
"underscore": "*" | ||
} | ||
} |