Skip to content

fix(resolution) Eliminate "missing peerDep" warning when dep exists at root level. #5088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions __tests__/commands/install/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -1177,3 +1177,22 @@ test.concurrent('install will not overwrite linked dependencies', async (): Prom
});
});
});

// There was a warning being generated when a peerDep existed at a deeper level, and at the top level.
// See https://github.com/yarnpkg/yarn/issues/4743
//
// package.json
// |- b
// | |- caniuse-api
// | |- caniuse-lite
// |- caniuse-lite
//
// When `b` also has a peerDep on `caniuse-lite` then Yarn was issuing a warning that the dep was missing.
test.concurrent('install will not warn for missing peerDep when both shallower and deeper', (): Promise<void> => {
return runInstall({}, 'peer-dep-included-at-2-levels', (config, reporter, install, getStdout) => {
const stdout = getStdout();
const messageParts = reporter.lang('unmetPeer').split('undefined');
const warningMessage = messageParts.every(part => stdout.includes(part));
expect(warningMessage).toBe(false);
});
});
15 changes: 15 additions & 0 deletions __tests__/commands/why.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,18 @@ test.concurrent('should determine that the module installed because it is hoiste
expect(report[report.length - 2].data).toEqual(reporter.lang('whyHoistedTo', 'glob#minimatch'));
});
});

test('should report when a module is included multiple times including the root', (): Promise<void> => {
return runWhy({}, ['caniuse-lite'], 'dep-included-at-2-levels', (config, reporter) => {
const report = reporter.getBuffer();
const reasons = report
.filter(entry => entry.type === 'list' && entry.data.type === 'reasons')
.map(entry => entry.data.items)[0];

expect(reasons).toEqual([
'"b#caniuse-api" depends on it',
'"b#caniuse-api#browserslist" depends on it',
'Specified in "dependencies"',
]);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "b",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"caniuse-api": "^2.0.0"
},
"peerDependencies": {
"caniuse-lite": "^1.0.30000697"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "a",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"b": "file:./b",
"caniuse-lite": "^1.0.0"
}
}

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
HTTP/1.1 200 OK
Date: Mon, 11 Dec 2017 18:38:51 GMT
Content-Type: application/vnd.npm.install-v1+json
Content-Length: 8269
Connection: keep-alive
Set-Cookie: __cfduid=d88832e1949be97719a1f327c4bc4f7421513017531; expires=Tue, 11-Dec-18 18:38:51 GMT; path=/; domain=.yarnpkg.com; HttpOnly
Cache-Control: max-age=300
Last-Modified: Wed, 3 May 2017 9:12:01 GMT
ETag: "59099ee1-204d"
Accept-Ranges: bytes
Via: 1.1 varnish
Age: 2254
X-Served-By: cache-mdw17347-MDW
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1513017532.519062,VS0,VE0
Vary: Accept-Encoding, Accept
Server: cloudflare-nginx
CF-RAY: 3cba9033fd705625-ORD

{"versions":{"0.1.0":{"name":"caniuse-api","version":"0.1.0","dependencies":{"browserslist":"^0.1.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1"},"devDependencies":{"6to5":"^1.14.17","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"2363d7908466950f57637a2861c3d53dd6003a55","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-0.1.0.tgz"}},"1.0.0":{"name":"caniuse-api","version":"1.0.0","dependencies":{"browserslist":"^0.1.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1"},"devDependencies":{"6to5":"^1.14.17","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"392efe3eaea6a46ee9ee058f47d33c6dc9607923","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.0.0.tgz"}},"1.1.0":{"name":"caniuse-api","version":"1.1.0","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1"},"devDependencies":{"6to5":"^1.14.17","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"2969d343a6871d950b28d341f15a750227e2210b","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.1.0.tgz"}},"1.2.0":{"name":"caniuse-api","version":"1.2.0","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1"},"devDependencies":{"6to5":"^1.14.17","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"1803b57e3327e27baa91997b3f21b52a7625e967","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.2.0.tgz"}},"1.2.1":{"name":"caniuse-api","version":"1.2.1","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1"},"devDependencies":{"6to5":"^1.14.17","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"264bafaf1a5badbfb76f891bd4d285d4ad135cf7","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.2.1.tgz"}},"1.2.2":{"name":"caniuse-api","version":"1.2.2","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1","shelljs":"^0.3.0"},"devDependencies":{"6to5":"^1.14.17","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"627c88d0f7f818eac8cd6b424e2874fde7e72f1e","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.2.2.tgz"}},"1.3.0":{"name":"caniuse-api","version":"1.3.0","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1","shelljs":"^0.3.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.0.0","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"0181b686fbbaf48791e2c35fdab76f616a21a593","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.3.0.tgz"}},"1.3.1":{"name":"caniuse-api","version":"1.3.1","dependencies":{"browserslist":"^0.2.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^2.4.1","shelljs":"^0.3.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.0.0","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"74fcf47e119dfc619237d9f3a7e98699781008ea","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.3.1.tgz"}},"1.3.2":{"name":"caniuse-api","version":"1.3.2","dependencies":{"browserslist":"^0.4.0","caniuse-db":"^1.0.30000030","lodash.memoize":"^2.4.1","lodash.uniq":"^3.1.0","shelljs":"^0.3.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.0.0","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"742c3e194ccb3bcbdb3cb492b511a47499d79e96","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.3.2.tgz"}},"1.4.0":{"name":"caniuse-api","version":"1.4.0","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^2.4.1","lodash.uniq":"^3.1.0","shelljs":"^0.5.3"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.0.0","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"422227e1fc3176b6f94f70c3e991f67c61cd5b2b","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.4.0.tgz"}},"1.4.1":{"name":"caniuse-api","version":"1.4.1","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^2.4.1","lodash.uniq":"^3.1.0","shelljs":"^0.5.3"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.0.0","jshint":"^2.5.10","tap-spec":"^2.1.1","tape":"^3.0.3"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"47f9c1ba01428681e13cd9e62f38daeda1a2495c","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.4.1.tgz"}},"1.5.0":{"name":"caniuse-api","version":"1.5.0","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^4.1.0","lodash.uniq":"^4.3.0","shelljs":"^0.7.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.3.1","jshint":"^2.5.10","tap-spec":"^4.1.1","tape":"^4.5.1"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"e0a6d8cdaf7229baf0552530c23c6bc4df9bf0ef","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.5.0.tgz"}},"1.5.1":{"name":"caniuse-api","version":"1.5.1","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^4.1.0","lodash.uniq":"^4.3.0","shelljs":"^0.7.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.3.1","jshint":"^2.5.10","npmpub":"^3.1.0","tap-spec":"^4.1.1","tape":"^4.5.1"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"8edb536c41e2a3d0e5e960538a8398f00be46b27","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.5.1.tgz"}},"1.5.2":{"name":"caniuse-api","version":"1.5.2","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^4.1.0","lodash.uniq":"^4.3.0","shelljs":"^0.7.0"},"devDependencies":{"babel":"^4.7.16","babel-tape-runner":"^1.3.1","jshint":"^2.5.10","npmpub":"^3.1.0","tap-spec":"^4.1.1","tape":"^4.5.1"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"8f393c682f661c0a997b77bba6e826483fb3600e","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.5.2.tgz"}},"1.5.3":{"name":"caniuse-api","version":"1.5.3","dependencies":{"browserslist":"^1.0.1","caniuse-db":"^1.0.30000346","lodash.memoize":"^4.1.0","lodash.uniq":"^4.3.0"},"devDependencies":{"babel-cli":"^6.22.2","babel-eslint":"^5.0.0","babel-preset-latest":"^6.22.0","babel-tape-runner":"^2.0.1","jshint":"^2.5.10","npmpub":"^3.1.0","tap-spec":"^4.1.1","tape":"^4.5.1"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"5018e674b51c393e4d50614275dc017e27c4a2a2","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.5.3.tgz"}},"1.6.1":{"name":"caniuse-api","version":"1.6.1","dependencies":{"browserslist":"^1.3.6","caniuse-db":"^1.0.30000529","lodash.memoize":"^4.1.2","lodash.uniq":"^4.5.0"},"devDependencies":{"babel-cli":"^6.22.2","babel-eslint":"^5.0.0","babel-preset-latest":"^6.22.0","babel-tape-runner":"^2.0.1","jshint":"^2.5.10","npmpub":"^3.1.0","tap-spec":"^4.1.1","tape":"^4.6.0"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"b534e7c734c4f81ec5fbe8aca2ad24354b962c6c","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.6.1.tgz"}},"2.0.0":{"name":"caniuse-api","version":"2.0.0","dependencies":{"browserslist":"^2.0.0","caniuse-lite":"^1.0.0","lodash.memoize":"^4.1.2","lodash.uniq":"^4.5.0"},"devDependencies":{"babel-cli":"^6.22.2","babel-eslint":"^5.0.0","babel-preset-latest":"^6.22.0","babel-tape-runner":"^2.0.1","jshint":"^2.5.10","npmpub":"^3.1.0","tap-spec":"^4.1.1","tape":"^4.6.0"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"b1ddb5a5966b16f48dc4998444d4bbc6c7d9d834","tarball":"https://registry.npmjs.org/caniuse-api/-/caniuse-api-2.0.0.tgz"}}},"name":"caniuse-api","dist-tags":{"latest":"2.0.0"},"modified":"2017-05-03T09:12:01.052Z"}
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Loading