Skip to content

Commit

Permalink
fix(jest-haste-map): Add computeDependencies to cache path
Browse files Browse the repository at this point in the history
  • Loading branch information
motiz88 committed Sep 30, 2021
1 parent da7c4a4 commit 83705af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Fixes

- `[jest-haste-map]` Use distinct cache paths for different values of `computeDependencies`.

### Chore & Maintenance

### Performance
Expand Down
14 changes: 14 additions & 0 deletions packages/jest-haste-map/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 83705af

Please sign in to comment.