diff --git a/__tests__/commands/install/integration.js b/__tests__/commands/install/integration.js index 4106128210..7a13d66fd4 100644 --- a/__tests__/commands/install/integration.js +++ b/__tests__/commands/install/integration.js @@ -212,6 +212,30 @@ test.concurrent('install file: protocol with relative paths', (): Promise }); }); +test.concurrent('install file: protocol without cache', async (): Promise => { + 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 => { return runInstall({noLockfile: true}, 'install-file', async (config) => { assert.equal( diff --git a/__tests__/fixtures/install/install-file-without-cache/comp/.gitignore b/__tests__/fixtures/install/install-file-without-cache/comp/.gitignore new file mode 100644 index 0000000000..9d8a81a138 --- /dev/null +++ b/__tests__/fixtures/install/install-file-without-cache/comp/.gitignore @@ -0,0 +1,2 @@ +# this file will be generated +index.js diff --git a/__tests__/fixtures/install/install-file-without-cache/comp/package.json b/__tests__/fixtures/install/install-file-without-cache/comp/package.json new file mode 100644 index 0000000000..c7af479c50 --- /dev/null +++ b/__tests__/fixtures/install/install-file-without-cache/comp/package.json @@ -0,0 +1,4 @@ +{ + "name": "comp", + "version": "1.0.0" +} diff --git a/__tests__/fixtures/install/install-file-without-cache/package.json b/__tests__/fixtures/install/install-file-without-cache/package.json new file mode 100644 index 0000000000..478addfb42 --- /dev/null +++ b/__tests__/fixtures/install/install-file-without-cache/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "comp": "file:comp" + } +}