Skip to content

Commit

Permalink
fix(jest-haste-map): Add computeDependencies to cache path (#11916)
Browse files Browse the repository at this point in the history
  • Loading branch information
motiz88 committed Sep 30, 2021
1 parent ba55fe7 commit c3b0946
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions packages/jest-haste-map/src/__tests__/index.test.js
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/jest-haste-map/src/index.ts
Expand Up @@ -325,6 +325,7 @@ export default class HasteMap extends EventEmitter {
(options.ignorePattern || '').toString(),
hasteImplHash,
dependencyExtractorHash,
this._options.computeDependencies.toString(),
);
this._buildPromise = null;
this._watchers = [];
Expand Down

0 comments on commit c3b0946

Please sign in to comment.