timkindberg / jest-when

Jest support for mock argument-matched return values.
MIT License
734 stars 38 forks source link

increase test coverage by testing that mockImplementationOnce only mocks once #42

Closed jeyj0 closed 4 years ago

jeyj0 commented 4 years ago

This kills one of the two surviving mutants that stryker still finds. :)

timkindberg commented 4 years ago

Hmm, I should start by saying good on you for doing the work and putting it out there, and I'm gonna feel bad saying this but I'm not sure I'm open to merging this. I'll tell you why and I hope you understand.

It feels like you essentially just have a differing opinion on the API and that's really it. I made the names the way I thought they should be for good reasons, namely they follow the same naming conventions as core jest mock function methods. I wanted it to "feel" like just another core jest feature.

I feel like the given/when/then is not something that's part of the core jest mindset. So I'll have to recommend that you fork this for fans of that methodology.

Sorry!! :(

jeyj0 commented 4 years ago

Thanks for the kind reply! This PR was actually just supposed to increase the test coverage, using the first of the two commits... Damnit, I didn't realize it'd update the PR with the follow-up commit.

The alternative syntax was really just a suggestion, and I didn't necessarily expect you to merge it, I'm happy to use my own fork. :)