diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ceeb3d5e4e0..41a1989f2459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Fixes +- `[jest-haste-map]` Use distinct cache paths for different values of `computeDependencies`. + ### Chore & Maintenance ### Performance diff --git a/packages/jest-haste-map/src/__tests__/index.test.js b/packages/jest-haste-map/src/__tests__/index.test.js index c95ed070998f..90ca7dccf774 100644 --- a/packages/jest-haste-map/src/__tests__/index.test.js +++ b/packages/jest-haste-map/src/__tests__/index.test.js @@ -265,6 +265,20 @@ describe('HasteMap', () => { expect(hasteMap1.getCacheFilePath()).not.toBe(hasteMap2.getCacheFilePath()); }); + it('creates different cache file paths for different values of computeDependencies', () => { + jest.resetModules(); + const HasteMap = require('../').default; + const hasteMap1 = new HasteMap({ + ...defaultConfig, + computeDependencies: true, + }); + const hasteMap2 = new HasteMap({ + ...defaultConfig, + computeDependencies: false, + }); + expect(hasteMap1.getCacheFilePath()).not.toBe(hasteMap2.getCacheFilePath()); + }); + it('creates different cache file paths for different hasteImplModulePath cache keys', () => { jest.resetModules(); const HasteMap = require('../').default; diff --git a/packages/jest-haste-map/src/index.ts b/packages/jest-haste-map/src/index.ts index 213e623a4cfe..760f2a975afa 100644 --- a/packages/jest-haste-map/src/index.ts +++ b/packages/jest-haste-map/src/index.ts @@ -325,6 +325,7 @@ export default class HasteMap extends EventEmitter { (options.ignorePattern || '').toString(), hasteImplHash, dependencyExtractorHash, + this._options.computeDependencies.toString(), ); this._buildPromise = null; this._watchers = [];