Skip to content

Commit

Permalink
Create lockfile when missing even when integrity hash matches (#1888)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze authored and bestander committed Nov 16, 2016
1 parent b76ac93 commit 135fd87
Show file tree
Hide file tree
Showing 15 changed files with 282 additions and 2 deletions.
6 changes: 6 additions & 0 deletions __tests__/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,3 +682,9 @@ test.concurrent('install should not rewrite lockfile with no substantial changes
expect(newLockContent).not.toEqual(lockContent);
});
});

test.concurrent('lockfile should be created when missing even if integrity matches', (): Promise<void> => {
return runInstall({}, 'lockfile-missing', async (config, reporter) => {
expect(await fs.exists(path.join(config.cwd, 'yarn.lock')));
});
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions __tests__/fixtures/install/lockfile-missing/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"left-pad": "^1.1.3"
}
}
2 changes: 1 addition & 1 deletion __tests__/fixtures/request-cache/GET/localhost/.bin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HTTP/1.1 200 OK
Date: Mon, 14 Nov 2016 16:46:07 GMT
Date: Wed, 16 Nov 2016 15:06:25 GMT
Connection: close
Content-Length: 2

Expand Down
4 changes: 3 additions & 1 deletion src/cli/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ export class Install {
patterns: Array<string>,
): Promise<boolean> {
const match = await this.matchesIntegrityHash(patterns);
if (!this.flags.skipIntegrity && !this.flags.force && match.matches) {
const haveLockfile = await fs.exists(path.join(this.config.cwd, constants.LOCKFILE_FILENAME));

if (!this.flags.skipIntegrity && !this.flags.force && match.matches && haveLockfile) {
this.reporter.success(this.reporter.lang('upToDate'));
return true;
}
Expand Down

0 comments on commit 135fd87

Please sign in to comment.