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 ba55fe7 commit ec6c7db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
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 ec6c7db

Please sign in to comment.