-
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.
Prioritise popular transitive dependencies when hoisting (#2676)
- Loading branch information
Showing
7 changed files
with
141 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* @flow */ | ||
|
||
import {getPackageVersion, runInstall} from '../_helpers.js'; | ||
import * as fs from '../../../src/util/fs.js'; | ||
|
||
const assert = require('assert'); | ||
const path = require('path'); | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000; | ||
|
||
test.concurrent('install hoister should prioritise popular transitive dependencies', (): Promise<void> => { | ||
// a -> b -> b-2 | ||
// -> c | ||
// -> b-2 | ||
return runInstall({}, 'install-should-prioritise-popular-transitive', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'b'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'a/b'), '0.0.0'); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
__tests__/fixtures/install/install-should-prioritise-popular-transitive/a/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": "a", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"b": "file:../b" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__tests__/fixtures/install/install-should-prioritise-popular-transitive/b-2/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,4 @@ | ||
{ | ||
"name": "b", | ||
"version": "2.0.0" | ||
} |
8 changes: 8 additions & 0 deletions
8
__tests__/fixtures/install/install-should-prioritise-popular-transitive/b/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,8 @@ | ||
{ | ||
"name": "b", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"b": "file:../b-2", | ||
"c": "file:../c" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
__tests__/fixtures/install/install-should-prioritise-popular-transitive/c/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": "c", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"b": "file:../b-2" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
__tests__/fixtures/install/install-should-prioritise-popular-transitive/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,5 @@ | ||
{ | ||
"dependencies": { | ||
"a": "file:a" | ||
} | ||
} |
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