Skip to content

Commit

Permalink
add test for save-exact
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedelgabri committed Sep 16, 2017
1 parent 54b7f63 commit 8f39f6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions __tests__/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ test.concurrent('add save-prefix should not expand ~ to home dir', (): Promise<v
});
});

test.concurrent('add save-exact should make all package.json strict', (): Promise<void> => {
return runAdd(['left-pad'], {}, 'install-strict-all', async config => {
const lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock')));

expect(lockfile[0]).toMatch(/^left-pad@\d+\.\d+\.\d+:$/);
expect(JSON.parse(await fs.readFile(path.join(config.cwd, 'package.json'))).dependencies['left-pad']).toMatch(
/^\d+\.\d+\.\d+$/,
);
});
});

test.concurrent('add with new dependency should be deterministic 3', (): Promise<void> => {
return runAdd([], {}, 'install-should-cleanup-when-package-json-changed-3', async (config, reporter) => {
// expecting yarn check after installation not to fail
Expand Down
2 changes: 2 additions & 0 deletions __tests__/fixtures/add/install-strict-all/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn-offline-mirror "./mirror-for-offline"
save-exact true

0 comments on commit 8f39f6b

Please sign in to comment.