Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't cache dependencies installed with file: protocol - add unit test #2443

Merged
merged 3 commits into from
Jan 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions __tests__/commands/install/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,30 @@ test.concurrent('install file: protocol with relative paths', (): Promise<void>
});
});

test.concurrent('install file: protocol without cache', async (): Promise<void> => {
const fixturesLoc = path.join(__dirname, '..', '..', 'fixtures', 'install');
const compLoc = path.join(fixturesLoc, 'install-file-without-cache', 'comp', 'index.js');

await fs.writeFile(compLoc, 'foo\n');
await runInstall({}, 'install-file-without-cache', async (config, reporter) => {
assert.equal(
await fs.readFile(path.join(config.cwd, 'node_modules', 'comp', 'index.js')),
'foo\n',
);

await fs.writeFile(compLoc, 'bar\n');

const reinstall = new Install({}, config, reporter, await Lockfile.fromDirectory(config.cwd));
await reinstall.init();

// TODO: This should actually be equal. See https://github.com/yarnpkg/yarn/pull/2443.
assert.notEqual(
await fs.readFile(path.join(config.cwd, 'node_modules', 'comp', 'index.js')),
'bar\n',
);
});
});

test.concurrent('install file: protocol', (): Promise<void> => {
return runInstall({noLockfile: true}, 'install-file', async (config) => {
assert.equal(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# this file will be generated
index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "comp",
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"comp": "file:comp"
}
}