Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor visibility to fix numerous environmental bugs (#2116)
- Loading branch information
Sebastian McKenzie
committed
Dec 3, 2016
1 parent
1ea09c2
commit 6e7d396
Showing
34 changed files
with
622 additions
and
387 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 |
---|---|---|
@@ -0,0 +1,200 @@ | ||
/* @flow */ | ||
|
||
import {getPackageVersion, runInstall} from '../_helpers.js'; | ||
|
||
const assert = require('assert'); | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 0', (): Promise<void> => { | ||
// A@2.0.1 -> B@2.0.0 | ||
// B@1.0.0 | ||
// should result in B@2.0.0 not flattened | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-0', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a/dep-b'), '2.0.0'); | ||
}); | ||
}); | ||
|
||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 1', (): Promise<void> => { | ||
// A@2.0.1 -> B@2.0.0 | ||
// should result in B@2.0.0 flattened | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-1', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '2.0.1'); | ||
}); | ||
}); | ||
|
||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 2', (): Promise<void> => { | ||
// A@2 -> B@2 -> C@2 | ||
// -> D@1 | ||
// B@1 -> C@1 | ||
// should become | ||
// A@2 | ||
// A@2 -> B@2 | ||
// A@2 -> C@2 | ||
// D@1 | ||
// C@1 | ||
// B@1 | ||
|
||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-2', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a/dep-b'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a/dep-c'), '2.0.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 3', (): Promise<void> => { | ||
// A@2 -> B@2 -> C@2 | ||
// -> D@1 | ||
// -> C@1 | ||
// should become | ||
// A@2 | ||
// B@2 -> C@2 | ||
// C@1 | ||
// D@1 | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-3', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b/dep-c'), '2.0.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 4', (): Promise<void> => { | ||
// A@2 -> B@2 -> D@1 -> C@2 | ||
// | ||
// -> C@1 | ||
|
||
// should become | ||
// A@2 | ||
// D@1 -> C@2 | ||
// C@1 | ||
// B@2 | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-4', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d/dep-c'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '2.0.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 5', (): Promise<void> => { | ||
// A@1 -> B@1 | ||
// C@1 -> D@1 -> A@2 -> B@2 | ||
|
||
// should become | ||
|
||
// A@1 | ||
// B@1 | ||
// C@1 | ||
// D@1 -> A@2 | ||
// -> B@2 | ||
|
||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-5', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d/dep-a'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d/dep-b'), '2.0.0'); | ||
|
||
}); | ||
}); | ||
|
||
test.concurrent( | ||
'install should dedupe dependencies avoiding conflicts 6 (jest/jest-runtime case)', | ||
(): Promise<void> => { | ||
// C@1 -> D@1 -> E@1 | ||
// B@1 -> C@1 -> D@1 -> E@1 | ||
// D@2 | ||
// E@2 | ||
|
||
// should become | ||
|
||
// C@1 -> D@1 | ||
// -> E@1 | ||
// B@1 | ||
// D@2 | ||
// E@2 | ||
|
||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-6', async (config): Promise<void> => { | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-e'), '2.0.0'); | ||
|
||
assert.equal(await getPackageVersion(config, 'dep-c/dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c/dep-e'), '1.0.0'); | ||
}); | ||
}, | ||
); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 7', (): Promise<void> => { | ||
// A@1 -> C@1 -> D@1 -> E@1 | ||
// B@1 -> C@1 -> D@1 -> E@1 | ||
// C@2 | ||
// D@2 | ||
// E@2 | ||
|
||
// should become | ||
|
||
// A@1 -> C@1 | ||
// -> D@1 | ||
// -> E@1 | ||
// B@1 -> C@1 | ||
// -> D@1 | ||
// -> E@1 | ||
// C@2 | ||
// D@2 | ||
// E@2 | ||
|
||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-7', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'dep-a'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-c'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-d'), '2.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-e'), '2.0.0'); | ||
|
||
assert.equal(await getPackageVersion(config, 'dep-a/dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a/dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-a/dep-e'), '1.0.0'); | ||
|
||
assert.equal(await getPackageVersion(config, 'dep-b/dep-c'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b/dep-d'), '1.0.0'); | ||
assert.equal(await getPackageVersion(config, 'dep-b/dep-e'), '1.0.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 8', (): Promise<void> => { | ||
// revealed in https://github.com/yarnpkg/yarn/issues/112 | ||
// adapted for https://github.com/yarnpkg/yarn/issues/1158 | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-8', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'glob'), '5.0.15'); | ||
assert.equal(await getPackageVersion(config, 'findup-sync/glob'), '4.3.5'); | ||
assert.equal(await getPackageVersion(config, 'inquirer'), '0.8.5'); | ||
assert.equal(await getPackageVersion(config, 'lodash'), '3.10.1'); | ||
assert.equal(await getPackageVersion(config, 'ast-query/lodash'), '4.15.0'); | ||
assert.equal(await getPackageVersion(config, 'run-async'), '0.1.0'); | ||
}); | ||
}); | ||
|
||
test.concurrent('install should dedupe dependencies avoiding conflicts 9', (): Promise<void> => { | ||
// revealed in https://github.com/yarnpkg/yarn/issues/112 | ||
// adapted for https://github.com/yarnpkg/yarn/issues/1158 | ||
return runInstall({}, 'install-should-dedupe-avoiding-conflicts-9', async (config) => { | ||
assert.equal(await getPackageVersion(config, 'glob'), '5.0.15'); | ||
assert.equal(await getPackageVersion(config, 'findup-sync/glob'), '4.3.5'); | ||
assert.equal(await getPackageVersion(config, 'inquirer'), '0.8.5'); | ||
assert.equal(await getPackageVersion(config, 'lodash'), '3.10.1'); | ||
assert.equal(await getPackageVersion(config, 'ast-query/lodash'), '4.15.0'); | ||
assert.equal(await getPackageVersion(config, 'run-async'), '0.1.0'); | ||
}); | ||
}); |
Oops, something went wrong.