Closed IgnusG closed 1 year ago
I think this is the same issue being reported in #2040. This post breaks down the flow really well.
@panjiesw posted up a sample repo and instructions for how to replicate it.
I had a look at what was happening just to check it wasn't related to my original fix. The problem with the approach suggested above is it will break the times where this is the desired behaviour, if you have two test files in failure and you fix one file the message should still be "x passed, x failed in other file not rerun". These TAP tests fail with the fix.
I think the issue can be solved by something like https://github.com/bobthekingofegypt/ava/commit/f823a62c23d588712f9523523144951e539ac308. Or just setting previous failures array to the empty array when run all is triggered. It's confusing following the watcher logic though so I'm not sure of any side effects that the test cases aren't covering.
It's confusing following the watcher logic though so I'm not sure of any side effects that the test cases aren't covering.
Yea it's pretty old logic by now, and the tests use too many stubs. I was going to say that I think the test cases are fairly comprehensive but clearly there's a bug so I guess not 😄
I think we can make the change and I'll double check it in the PR. And separately do more of an integration-style test using the newer testing approach in test/
.
Do you want me to open that branch as a pull request? It was just there to help the conversation but happy to create a pull request for it.
@bobthekingofegypt yes that'd be useful.
Out of curiosity, is the fact that this issue was closed as “not planned” indicative of the fact that it is fixed? I think I ran into it last year.
I don't know, might be better in the main branch / next release.
I noticed that changing the source file sometimes leads to ava reporting a "1 previous failure in test files that were not rerun" even though the tests testing that file already passed. This message is a bit confusing since the test actually was rerun and passed.
I saw that the relevant line that "prunes" the failures is https://github.com/avajs/ava/blob/9cedc9770d5ac2a75c88f7f3b81c263c88989332/lib/watcher.js#L267
But that line seems to run after the failures have already been passed to the api at https://github.com/avajs/ava/blob/9cedc9770d5ac2a75c88f7f3b81c263c88989332/lib/watcher.js#L125 and it's therefore not up to date anymore (since we overwrite the array in prune - not modify it).
It's either possible to modify the array instead at https://github.com/avajs/ava/blob/9cedc9770d5ac2a75c88f7f3b81c263c88989332/lib/watcher.js#L293 or to pass it as a function that gets evaluated instead:
watcher.js
and
reporters/default.js