Skip to content

Commit

Permalink
don't cache dependencies installed with file: protocol - fixes yarnpk…
Browse files Browse the repository at this point in the history
…g#2165 (yarnpkg#2443)

* added failing unit test for yarnpkg#2165

* fixed unit test

* updated unit test
  • Loading branch information
donaldpipowitch authored and Constantine Antonakos committed Jan 30, 2017
1 parent 5a55b7d commit f8a5957
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
24 changes: 24 additions & 0 deletions __tests__/commands/install/integration.js
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
@@ -0,0 +1,2 @@
# this file will be generated
index.js
@@ -0,0 +1,4 @@
{
"name": "comp",
"version": "1.0.0"
}
@@ -0,0 +1,5 @@
{
"dependencies": {
"comp": "file:comp"
}
}

0 comments on commit f8a5957

Please sign in to comment.