diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb9c5886151..828a9175cba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - `[@jest/types]` Mark deprecated configuration options as `@deprecated` ([#11913](https://github.com/facebook/jest/pull/11913)) - `[jest-cli]` Improve `--help` printout by removing defunct `--browser` option ([#11914](https://github.com/facebook/jest/pull/11914)) +- `[jest-haste-map]` Use distinct cache paths for different values of `computeDependencies` ([#11916](https://github.com/facebook/jest/pull/11916)) ### Chore & Maintenance 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 = [];