fix: prevent confirmVerified(vararg mocks) from clearing unrelated mocks #1381
+33
β8
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.
π§ Draft Pull Request β Partial Fix for Issue #1379
This PR builds upon the changes introduced in #821, aiming to improve test isolation while addressing the regression reported in #1379.
π What's Being Done
internalConfirmVerifiedto reset only the specified mocks when parameters are passed.resetVerificationStateto selectively clear verification state for specific mocks.try-finally, making the verification process more robust.confirmVerifiedSpecificMockto verify thatconfirmVerified(mock)behavior is correct.This PR is still in progress. While the targeted clearing works in isolated tests, the test suite fails when running
confirmVerifiedAll.This issue appears similar to the cross-test interference previously addressed in issue #821, but now occurs when
confirmVerifiedis used without parameters after using it with specific mocks in other tests.π Notably, if we add a
clearAllMocks()call before theconfirmVerifiedAlltest, it passes successfully β just like it did before PR #1367.π Next Steps
Investigate and resolve the failure of
confirmVerifiedAllin the full test suite@Raibaz do you have any idea why this might be happening? It seems related to state retention when mixing
confirmVerified(mock)andconfirmVerified()in different tests.