Skip to content

Commit 5a191dd

Browse files
Jack AldridgeBYK
authored andcommitted
Chore: Adding additional test for pull request #3945 (#4078)
**Summary** Adding an additional test for an uncovered method from pull request #3945. The previous tests did not cover this, since the method, `getExactVersionMatch`, is only called if a package's `fresh` prop is false or the frozen flag is set. The fixtures directory for this test contains a lockfile to meet this condition. If the `manifest && getExoticResolver(version)` condition does not evaluate properly the `multiplePackagesCantUnpackInSameDestination` warning is logged. This test checks for that. **Test plan** New tests, obviously :)
1 parent 98af218 commit 5a191dd

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

__tests__/commands/install/integration.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,19 @@ test.concurrent('install file: dedupe dependencies 2', (): Promise<void> => {
491491
});
492492
});
493493

494+
// When local packages are installed from a repo with a lockfile, the multiple packages
495+
// unpacking in the same location warning should not occur
496+
test.concurrent('install file: dedupe dependencies 3', (): Promise<void> => {
497+
return runInstall({}, 'install-file-dedupe-dependencies-3', (config, reporter, install, getStdout) => {
498+
const stdout = getStdout();
499+
// Need to check if message is logged, but don't need to check for any specific parameters
500+
// so splitting on undefined and testing if all message parts are in stdout
501+
const messageParts = reporter.lang('multiplePackagesCantUnpackInSameDestination').split('undefined');
502+
const warningMessage = messageParts.every(part => stdout.includes(part));
503+
expect(warningMessage).toBe(false);
504+
});
505+
});
506+
494507
test.concurrent('install everything when flat is enabled', (): Promise<void> => {
495508
return runInstall({noLockfile: true, flat: true}, 'install-file', async config => {
496509
expect(await fs.readFile(path.join(config.cwd, 'node_modules', 'foo', 'index.js'))).toEqual('foobar;\n');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "a",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"b": "file:../b"
6+
}
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "b",
3+
"version": "1.0.0"
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"a": "file:a",
4+
"b": "file:./b"
5+
}
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
"a@file:a":
6+
version "1.0.0"
7+
dependencies:
8+
b "file:../b"
9+
10+
"b@file:./b", "b@file:b":
11+
version "1.0.0"

0 commit comments

Comments
 (0)