Skip to content

Introduce clearAllStubsFromMemory#1503

Merged
Raibaz merged 2 commits intomockk:masterfrom
nishatoma:add-clear-memory-method
Jan 20, 2026
Merged

Introduce clearAllStubsFromMemory#1503
Raibaz merged 2 commits intomockk:masterfrom
nishatoma:add-clear-memory-method

Conversation

@nishatoma
Copy link
Contributor

@nishatoma nishatoma commented Jan 18, 2026

Credits: @evgenru for the idea and good reproducer.

Fixes #1486 and #1420.

Allow consumers to clear stubRepository with a public method.

I thought of adding another boolean flag to clearAllMocks() initially but that one is used for both JUnit4 + 5 extension, so didn't want to introduce more complexities. So I ended up just adding a new method instead so as to not touch any existing logic. @evgenru @Raibaz @oleksiyp let me know if you have any thoughts on this.

@Raibaz
Copy link
Collaborator

Raibaz commented Jan 20, 2026

I like this, the change LGTM, thanks!

Would you please be able to add documentation about it in README.md? 🙏

@nishatoma
Copy link
Contributor Author

@Raibaz Thanks for the feedback 🙏

The api table was updated as part of initial commit. Is there any specific thing you would like me to mention in it?

@Raibaz
Copy link
Collaborator

Raibaz commented Jan 20, 2026

Ah, you're right, I missed that in my latest review. Sorry 🙏

@Raibaz Raibaz merged commit e4ff90b into mockk:master Jan 20, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clearAllMocks() slows down test execution

2 participants