Skip to content

Commit

Permalink
check lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 2, 2024
1 parent 4633880 commit 7df45c8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/jest-haste-map/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type Watcher = {

type HasteWorker = typeof import('./worker');

const isWatchmanInstalledPromise = isWatchmanInstalled();
let isWatchmanInstalledPromise: Promise<boolean> | undefined;

export const ModuleMap = HasteModuleMap as {
create: (rootPath: string) => IModuleMap;
Expand Down Expand Up @@ -1109,6 +1109,9 @@ class HasteMap extends EventEmitter implements IHasteMap {
if (!this._options.useWatchman) {
return false;
}
if (!isWatchmanInstalledPromise) {
isWatchmanInstalledPromise = isWatchmanInstalled();
}
return isWatchmanInstalledPromise;
}

Expand Down

0 comments on commit 7df45c8

Please sign in to comment.