jest-haste-map: Fork watchman watcher so we can fix things #5387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is just a fork of the WatchmanWatcher as modified in amasad/sane#106. I also modified a few things (ex. use const/let) to make it pass the linter. However, no logic should have been changed by this changeset.
The reason for forking is that (1) the new
fresh_instance
is hard to fit into the model ofsane
, that wasn't designed for that possibility and (2)sane
doesn't fit very well around watchman model to start with. With watchman, one is not supposed to do the file system crawling and watching operations separately. The reason for that is that files may have changed before you even start watching. Instead, "add" events are generated when you start watching, or you have to use the concept of clock specs to ensure continuity.So overall the PR on
sane
was just a hack, and it will be cleaner to fork and have a unified way to use thefb-watchman
package, that we do already use for the file crawling injest-haste-map
.The follow-up on this changeset will be to react properly to
fresh_instance
events. The longer term follow up is to flowify/clean-up, then ensure continuity by feeding the crawling clock back into the subscription.Test plan
Would the existing automated test ensure proper functioning of the watch?