-
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.
latest version of yarn master merged with cyan color of powershell
- Loading branch information
=
committed
Dec 7, 2017
1 parent
63d1d0d
commit 40210b6
Showing
51 changed files
with
992 additions
and
24 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,63 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`returns noBinAvailable with no bins 1`] = ` | ||
Array [ | ||
Object { | ||
"data": "No command specified.", | ||
"error": true, | ||
"type": "error", | ||
}, | ||
Object { | ||
"data": "There are no binary scripts available.", | ||
"error": true, | ||
"type": "error", | ||
}, | ||
Object { | ||
"data": "Project commands", | ||
"error": false, | ||
"type": "info", | ||
}, | ||
Object { | ||
"data": Object { | ||
"hints": Object { | ||
"build": "echo 'building'", | ||
"prestart": "echo 'prestart'", | ||
"start": "node index.js", | ||
}, | ||
"items": Array [ | ||
"build", | ||
"prestart", | ||
"start", | ||
], | ||
"type": "possibleCommands", | ||
}, | ||
"error": false, | ||
"type": "list", | ||
}, | ||
Object { | ||
"data": "No command specified.", | ||
"error": true, | ||
"type": "error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`returns noScriptsAvailable with no scripts 1`] = ` | ||
Array [ | ||
Object { | ||
"data": "No command specified.", | ||
"error": true, | ||
"type": "error", | ||
}, | ||
Object { | ||
"data": "Commands available from binary scripts: cat-names", | ||
"error": false, | ||
"type": "info", | ||
}, | ||
Object { | ||
"data": "There are no scripts specified inside package.json.", | ||
"error": true, | ||
"type": "error", | ||
}, | ||
] | ||
`; |
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 |
---|---|---|
|
@@ -147,6 +147,16 @@ test.concurrent('install with --optional flag', (): Promise<void> => { | |
}); | ||
}); | ||
|
||
test.concurrent('install with --tilde flag', (): Promise<void> => { | ||
return runAdd(['[email protected]'], {tilde: true}, 'add-with-flag', async config => { | ||
const lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock'))); | ||
const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); | ||
|
||
expect(lockfile.indexOf('isarray@~2.0.1:')).toEqual(0); | ||
expect(pkg.dependencies).toEqual({isarray: '~2.0.1'}); | ||
}); | ||
}); | ||
|
||
// Test if moduleAlreadyInManifest warning is displayed | ||
const moduleAlreadyInManifestChecker = ({expectWarnings}: {expectWarnings: boolean}) => async ( | ||
args, | ||
|
@@ -609,6 +619,27 @@ test.concurrent('upgrade scenario 2 (with sub dependencies)', (): Promise<void> | |
}); | ||
}); | ||
|
||
test.concurrent('install another fork of an existing package', (): Promise<void> => { | ||
// When installing a package with the same name as an existing one but from a different repo, | ||
// the old one should be replaced with the new one in the lock file. | ||
const firstSource = 'davidreis97/example-yarn-package#master'; | ||
const secondSource = 'yarnpkg/example-yarn-package#master'; | ||
const pkgName = 'example-yarn-package'; | ||
return runAdd([firstSource], {}, 'install-forked-git', async (config, reporter): Promise<void> => { | ||
let lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock'))); | ||
expect(lockfile.indexOf(`${pkgName}@${firstSource}:`)).toEqual(0); | ||
expect(lockfile.indexOf(`${pkgName}@${secondSource}:`)).toEqual(-1); | ||
|
||
const add = new Add([secondSource], {}, config, reporter, await Lockfile.fromDirectory(config.cwd)); | ||
await add.init(); | ||
|
||
lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock'))); | ||
|
||
expect(lockfile.indexOf(`${pkgName}@${firstSource}:`)).toEqual(-1); | ||
expect(lockfile.indexOf(`${pkgName}@${secondSource}:`)).toEqual(0); | ||
}); | ||
}); | ||
|
||
test.concurrent('downgrade scenario', (): Promise<void> => { | ||
// left-pad first installed 1.1.0 then downgraded to 0.0.9 | ||
// files in mirror, yarn.lock, package.json and node_modules should reflect that | ||
|
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 |
---|---|---|
|
@@ -351,6 +351,24 @@ test.concurrent('should ignore bundled dependencies', async (): Promise<void> => | |
); | ||
}); | ||
|
||
test.concurrent('should warn about mismatched dependencies if they match resolutions', async (): Promise<void> => { | ||
let mismatchError = false; | ||
let stdout = ''; | ||
try { | ||
await runCheck([], {}, 'resolutions', (config, reporter, check, getStdout) => { | ||
stdout = getStdout(); | ||
}); | ||
} catch (err) { | ||
mismatchError = true; | ||
} | ||
expect(mismatchError).toEqual(false); | ||
expect( | ||
stdout.search( | ||
`warning.*"[email protected]" is incompatible with requested version "pad-left#repeat-string@\\^1.5.4"`, | ||
), | ||
).toBeGreaterThan(-1); | ||
}); | ||
|
||
test.concurrent('--integrity should throw an error if top level patterns do not match', async (): Promise<void> => { | ||
let integrityError = false; | ||
try { | ||
|
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
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,6 @@ | ||
{ | ||
"name": "install-forked-git", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT" | ||
} |
18 changes: 18 additions & 0 deletions
18
__tests__/fixtures/check/resolutions/node_modules/.yarn-integrity
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
__tests__/fixtures/check/resolutions/node_modules/pad-left/LICENSE
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
134 changes: 134 additions & 0 deletions
134
__tests__/fixtures/check/resolutions/node_modules/pad-left/README.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.