-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly resolve peerDependencies for concurrent installs (#2801)
* Correctly resolve peerDependencies for concurrent installs * Tests for resolving peerDependencies when using add command
- Loading branch information
1 parent
cd13d01
commit 0ad2bf9
Showing
5 changed files
with
62 additions
and
41 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* @flow */ | ||
|
||
import {ConsoleReporter} from '../../src/reporters/index.js'; | ||
import * as reporters from '../../src/reporters/index.js'; | ||
import {getPackageVersion, createLockfile, explodeLockfile, run as buildRun, runInstall} from './_helpers.js'; | ||
import {Add} from '../../src/cli/commands/add.js'; | ||
import * as constants from '../../src/constants.js'; | ||
|
@@ -702,3 +703,55 @@ test.concurrent('install with latest tag and --prefer-offline flag', (): Promise | |
assert.notEqual(version, '1.1.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('doesn\'t warn when peer dependency is met during add', (): Promise<void> => { | ||
return buildRun( | ||
reporters.BufferReporter, | ||
fixturesLoc, | ||
async (args, flags, config, reporter, lockfile): Promise<void> => { | ||
const add = new Add(args, flags, config, reporter, lockfile); | ||
await add.init(); | ||
const output = reporter.getBuffer(); | ||
const warnings = output.filter((entry) => entry.type === 'warning'); | ||
assert(!warnings.some((warning) => warning.data.toString().toLowerCase().includes('unmet peer'))); | ||
assert(!warnings.some((warning) => warning.data.toString().toLowerCase().includes('incorrect peer'))); | ||
}, | ||
['[email protected]', '[email protected]'], | ||
{}, | ||
'add-with-peer-dependency-met', | ||
); | ||
}); | ||
|
||
test.concurrent('warns when peer dependency is not met during add', (): Promise<void> => { | ||
return buildRun( | ||
reporters.BufferReporter, | ||
fixturesLoc, | ||
async (args, flags, config, reporter, lockfile): Promise<void> => { | ||
const add = new Add(args, flags, config, reporter, lockfile); | ||
await add.init(); | ||
const output = reporter.getBuffer(); | ||
const warnings = output.filter((entry) => entry.type === 'warning'); | ||
assert(warnings.some((warning) => warning.data.toString().toLowerCase().includes('unmet peer'))); | ||
}, | ||
['[email protected]'], | ||
{}, | ||
'add-with-peer-dependency-not-met', | ||
); | ||
}); | ||
|
||
test.concurrent('warns when peer dependency is incorrect during add', (): Promise<void> => { | ||
return buildRun( | ||
reporters.BufferReporter, | ||
fixturesLoc, | ||
async (args, flags, config, reporter, lockfile): Promise<void> => { | ||
const add = new Add(args, flags, config, reporter, lockfile); | ||
await add.init(); | ||
const output = reporter.getBuffer(); | ||
const warnings = output.filter((entry) => entry.type === 'warning'); | ||
assert(warnings.some((warning) => warning.data.toString().toLowerCase().includes('incorrect peer'))); | ||
}, | ||
['[email protected]', '[email protected]'], | ||
{}, | ||
'add-with-peer-dependency-incorrect', | ||
); | ||
}); |
Empty file.
Empty file.
Empty file.
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