update doc to warn potential partial coverage in watch mode #654
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.
Noticed the coverage sometimes is incorrect in watch mode, depends on what files are changed and their relationship with the target file. It does make sense with the
--watch
flag that it will only run tests that changed and thus produce partial coverage sometimes. See more detailed discussion in jestjs/jest#1284.In theory, we can pass
--watchAll
to ensure the coverage is correct, but it could have a significant performance implication especially for large projects. I don't recall many issues related to this kind of inconsistency, so not sure if it justifies the change/impact. One other possible solution is to introduce a customization flag for using--watchAll
with coverage. Should be pretty straightforward if there are enough use cases.Anyway, I ended up just updated the README to give a warning and corrected a bug I found during the investigation.