Skip to content

Commit

Permalink
added a test for #1733 (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
bestander authored Nov 9, 2016
1 parent eae3317 commit 8e9ec88
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions __tests__/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,33 @@ test.concurrent('add should store latest version in lockfile', (): Promise<void>
const lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock')));
const pkg = await fs.readJson(path.join(config.cwd, 'package.json'));

assert(lockfile.indexOf('max-safe-integer@^1.0.1:') === 0);
assert.deepEqual(pkg.dependencies, {'max-safe-integer': '^1.0.1'});
const version = pkg.dependencies['max-safe-integer'];
assert(semver.valid(version.slice(1)));
assert(lockfile.indexOf('max-safe-integer:') === -1);
assert(lockfile.indexOf(`max-safe-integer@${version}:`) === 0);
});
});

// TODO disabled until https://github.com/yarnpkg/yarn/issues/1733 is fixed
test.skip('add should generate correct integrity file', (): Promise<void> => {
return runAdd({}, ['mime-db@1.24.0'], 'integrity-check', async (config, reporter) => {
let allCorrect = true;
try {
await check(config, reporter, {integrity: true}, []);
} catch (err) {
allCorrect = false;
}
expect(allCorrect).toBe(true);

// add to an existing package.json caused incorrect integrity https://github.com/yarnpkg/yarn/issues/1733
const add = new Add(['left-pad@1.1.3'], {}, config, reporter, await Lockfile.fromDirectory(config.cwd));
await add.init();
try {
await check(config, reporter, {integrity: true}, []);
} catch (err) {
allCorrect = false;
}
expect(allCorrect).toBe(true);
});

});
Empty file.

0 comments on commit 8e9ec88

Please sign in to comment.