-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix: only check for watchman existence once per process #14826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has nothing to do with the other fix, just sneaking it in as #14804 missed it |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,8 @@ type Watcher = { | |
|
|
||
| type HasteWorker = typeof import('./worker'); | ||
|
|
||
| let isWatchmanInstalledPromise: Promise<boolean> | undefined; | ||
|
|
||
| export const ModuleMap = HasteModuleMap as { | ||
| create: (rootPath: string) => IModuleMap; | ||
| }; | ||
|
|
@@ -216,7 +218,6 @@ class HasteMap extends EventEmitter implements IHasteMap { | |
| private _cachePath = ''; | ||
| private _changeInterval?: ReturnType<typeof setInterval>; | ||
| private readonly _console: Console; | ||
| private _isWatchmanInstalledPromise: Promise<boolean> | null = null; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this made the check happens once per project, while we now do it once per module scope (i.e. once per worker/thread/process) |
||
| private readonly _options: InternalOptions; | ||
| private _watchers: Array<Watcher> = []; | ||
| private _worker: JestWorkerFarm<HasteWorker> | HasteWorker | null = null; | ||
|
|
@@ -1108,10 +1109,10 @@ class HasteMap extends EventEmitter implements IHasteMap { | |
| if (!this._options.useWatchman) { | ||
| return false; | ||
| } | ||
| if (!this._isWatchmanInstalledPromise) { | ||
| this._isWatchmanInstalledPromise = isWatchmanInstalled(); | ||
| if (!isWatchmanInstalledPromise) { | ||
| isWatchmanInstalledPromise = isWatchmanInstalled(); | ||
| } | ||
| return this._isWatchmanInstalledPromise; | ||
| return isWatchmanInstalledPromise; | ||
| } | ||
|
|
||
| private _createEmptyMap(): InternalHasteMap { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hah, totally wrong format 😅
should be