-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest --changedSince=origin/master #5312
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5312 +/- ##
==========================================
- Coverage 61.32% 61.32% -0.01%
==========================================
Files 205 205
Lines 6909 6914 +5
Branches 4 4
==========================================
+ Hits 4237 4240 +3
- Misses 2671 2673 +2
Partials 1 1
Continue to review full report at Codecov.
|
This needs a rebase. Also, copying over my comment from the other PR.
|
0ba2431
to
9e6409a
Compare
CHANGELOG.md
Outdated
@@ -12,6 +12,9 @@ | |||
* `[jest-cli]` Make Jest exit without an error when no tests are found in the | |||
case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options | |||
having been passed to the CLI | |||
* `[jest-cli]` `--changedSince`: allow selectively running tests for code |
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.
can you move this to just below master
?
@@ -108,6 +108,12 @@ If you want to inspect the cache, use `--showConfig` and look at the | |||
Runs tests related to the current changes and the changes made in the last | |||
commit. Behaves similarly to `--onlyChanged`. | |||
|
|||
### `--changedSince` |
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.
Can you add a "Since Jest 22.1.3+" or something?
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.
I said 22.2.0 because announcing that a feature is available since a patch release makes me uneasy. If it turns out that we release this feature without bumping the minor version then then ##### available in Jest **22.2.0+**
is still not strictly a lie ;-)
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.
Couple of docs nits, no biggie.
Thank you so much for adding this! Cool feature
Question: If I say |
make changedFilesToContributeTo require an arg, and imply onlyChanged
92e1712
to
c95f4e3
Compare
Thanks for sticking with me as reviewer while I changed the spec and made a thousand rebases :D If you say --changedSince=HEAD then git will re-evaluate what HEAD is every time, so you would indeed need to The flag is designed to so that you can just If you just want to test the changes since the last time you did a git push, I think that |
Just used this for the first time, and it's awesome. Fits my workflow perfectly. Thanks @alsuren! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This is a duplicate of #5188 on the off-chance that the CI server's cache per-PR, and is therefore only poisoned for that PR.
I often have jest --watch running in a window, but sometimes I forget to look at it before committing, or I stage a bunch of changes that break tests, and it hides them from the test runner. This means that I often get surprised by CI test failures when I come to open pull requests.
This change allows you to write jest --watch --changedFilesToContributeTo=origin/master to test your entire feature branch, but not the whole project. It also tests only your changes if your branch has diverged from origin/master.
Test plan