From 8f39f6b67bafaafb4ce6e82e4b96bd49b16e37af Mon Sep 17 00:00:00 2001 From: Ahmed El Gabri Date: Fri, 15 Sep 2017 20:22:08 +0200 Subject: [PATCH] add test for save-exact --- __tests__/commands/add.js | 11 +++++++++++ __tests__/fixtures/add/install-strict-all/.yarnrc | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 __tests__/fixtures/add/install-strict-all/.yarnrc diff --git a/__tests__/commands/add.js b/__tests__/commands/add.js index 9f69035974..a3785ac53c 100644 --- a/__tests__/commands/add.js +++ b/__tests__/commands/add.js @@ -223,6 +223,17 @@ test.concurrent('add save-prefix should not expand ~ to home dir', (): Promise => { + 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 => { return runAdd([], {}, 'install-should-cleanup-when-package-json-changed-3', async (config, reporter) => { // expecting yarn check after installation not to fail diff --git a/__tests__/fixtures/add/install-strict-all/.yarnrc b/__tests__/fixtures/add/install-strict-all/.yarnrc new file mode 100644 index 0000000000..2e2098e184 --- /dev/null +++ b/__tests__/fixtures/add/install-strict-all/.yarnrc @@ -0,0 +1,2 @@ +yarn-offline-mirror "./mirror-for-offline" +save-exact true