Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/jest-haste-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,13 @@ class HasteMap extends EventEmitter {
* 1. read data from the cache or create an empty structure.
*/
read(): InternalHasteMap {
// This may throw. `_buildFileMap` will catch it and create a new map.
const hasteMap: InternalHasteMap = serializer.readFileSync(this._cachePath);
let hasteMap: InternalHasteMap;

try {
hasteMap = serializer.readFileSync(this._cachePath);
} catch (err) {
hasteMap = this._createEmptyMap();
}

for (const key in hasteMap) {
Object.setPrototypeOf(hasteMap[key], null);
Expand Down