forked from yarnpkg/yarn
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly install workspace child deps when workspace child not symli…
…nked to root (yarnpkg#7289) * Test for conflict between pkg versions in root and workspace child This test creates the scenario where the child is not symlinked into the root node_modules folder, because the root installs a different version of the workspace child from the registry. * fix(hoister): Correctly change path for ws child dependencies when child not hoisted * Update CHANGELOG.md * Better comment
- Loading branch information
1 parent
2778162
commit f3019e2
Showing
8 changed files
with
67 additions
and
11 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
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 |
---|---|---|
|
@@ -103,6 +103,25 @@ test.concurrent('install should install unhoistable dependencies in workspace no | |
}); | ||
}); | ||
|
||
test.concurrent( | ||
'install should install unhoistable dependencies in workspace node_modules even when no symlink exists', | ||
(): Promise<void> => { | ||
return runInstall({}, 'workspaces-install-conflict-without-symlink', async (config): Promise<void> => { | ||
// node_modules/[email protected] | ||
let packageFile = await fs.readFile(path.join(config.cwd, 'node_modules', 'isarray', 'package.json')); | ||
expect(JSON.parse(packageFile).version).toEqual('1.0.0'); | ||
|
||
// node_modules/[email protected] | ||
packageFile = await fs.readFile(path.join(config.cwd, 'node_modules', 'arrify', 'package.json')); | ||
expect(JSON.parse(packageFile).version).toEqual('1.0.0'); | ||
|
||
// node_modules/arrify/[email protected] | ||
packageFile = await fs.readFile(path.join(config.cwd, 'arrify', 'node_modules', 'isarray', 'package.json')); | ||
expect(JSON.parse(packageFile).version).toEqual('2.0.0'); | ||
}); | ||
}, | ||
); | ||
|
||
test.concurrent('install should link workspaces that refer each other', (): Promise<void> => { | ||
return runInstall({}, 'workspaces-install-link', async (config): Promise<void> => { | ||
// packages/workspace-1/node_modules/left-pad - missing because it is hoisted to the root | ||
|
7 changes: 7 additions & 0 deletions
7
__tests__/fixtures/install/workspaces-install-conflict-without-symlink/arrify/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": "arrify", | ||
"version": "2.0.0", | ||
"dependencies": { | ||
"isarray": "2.0.0" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
__tests__/fixtures/install/workspaces-install-conflict-without-symlink/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,11 @@ | ||
{ | ||
"name": "my-project", | ||
"private": true, | ||
"dependencies": { | ||
"arrify": "1.0.0", | ||
"isarray": "1.0.0" | ||
}, | ||
"workspaces": [ | ||
"arrify" | ||
] | ||
} |
Binary file added
BIN
+2.02 KB
__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/arrify/-/arrify-1.0.0.tgz.bin
Binary file not shown.
Binary file added
BIN
+2.58 KB
__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/isarray/-/isarray-2.0.0.tgz.bin
Binary file not shown.
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