-
-
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
changedSince runs specs related to files with no diff #9602
Comments
This is because we use I do agree this is not expected, though. @alsuren do you remember why you went with /cc @thymikee @jeysal do you agree it's not expected behavior? |
Yea, seems like diff makes more sense here. I wouldn't expect running tests for files that were changed+unchanged in the meantime. |
The reason I use I use I searched for quite a long time for a "please tell me which files would change if I merged my current branch into master" git invocation, but I couldn't work out how to express it. Does anyone know of a good way to express this in git? |
hrm...
maybe @finn-orsini do you want to try making a fix for this, or should I pick it up? (I probably won't have time until Tuesday though) |
@alsuren yeah I can give it a shot this afternoon! Thanks! |
One other thing that we should be aware of when fixing this is that some people abuse the "resolve conflicts" button on github ( https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github ) rather than rebasing when there are conflicts. (this is a behaviour that I only observed in the last few months) These people might end up with quite a lot of spurious tests being run under a
If someone is sitting at HEAD, will changedSince see changes related to A and any conflicts that happened, or will it also see unrelated changes from B and C? What happens if people are merging master into their branch purely to fix CI issues, and there aren't even any conflicts? I think I might be seeing this behaviour on my current project too, because our CI is set up to test branch-tips without merging with master first :-( . [edit to avoid spamming everyone with email notifications]: I guess we could take the output of log and diff, and only test files that show up in both lists? I would also be okay with letting people using the merge-heavy workflow break, and see if we get bug reports about it. I suspect that nobody will care, and it will make our code faster and cleaner (and more similar to the bzr case, if I remember correctly). This probably isn't my call to make though ;-) . [/edit] |
Great point! The current project I'm working on is extremely merge-heavy, so, unfortunately, that is something I would like to account for (and I'm fairly sure is why we noticed issues in I'm going to experiment with the diff only approach as well as comparing the output of log and diff - If neither of these are satisfactory for [edit] Seems like the workflow you described:
would be accounted for by using |
@finn-orsini |
Yeah, can we keep this moving? I'm also happy to help if needed @finn-orsini @alsuren @SimenB |
Sorry for the delay here, no excuse other than just totally dropped this from my radar. I have a fork with what I think was a working fix from when this was originally posted, will double-check it tomorrow morning & post an update here. Thanks for bearing with me! |
🎉 PR opened: #10155 |
Hi @finn-orsini do you know when this might be merged and released? I have a couple of things relying upon this update that I need to push through our company backlog. Thanks for any info you can provide :) |
👋 Hi @matthew-hallsworth, I believe @SimenB was waiting to see if anyone else wanted to weigh in on the PR. It has been approved, but I do not have access to merge 👍 |
Fix released in 26.2.0 |
🐛 Bug Report
Using the
--changedSince
flag, Jest will run specs related to files with no current code changes (no diff) but which were previously committed.The description of this flag is:
Runs tests related to the changes since the provided branch
. I would expect changes in this context to mean code changes between the current and specified revision, not each individual commit.To Reproduce
Steps to reproduce the behavior:
example.js
) which has a related spec (example.test.js
). Adding a comment will do.git diff origin/master
. There should be none.jest --changedSince origin/master
example.test.js
was run, even thoughexample.js
has no changes.Expected behavior
example.test.js
does not runLink to repl or repo (highly encouraged)
https://github.com/finn-orsini/jest-changed-since-bug-poc
yarn
changed_since_no_changes
(See PR showing no code changes here)yarn test
Output will show that
sum.test.js
was run:Note that running
git log --name-only --pretty=format: HEAD ^origin/master
(the command run by jest-changed-files) on this branch will includesum.js
since a comment was added and removed in previous commits.envinfo
The text was updated successfully, but these errors were encountered: