mcous / vitest-when

Stub behaviors of Vitest mock functions based on how they are called
MIT License
28 stars 3 forks source link

Add function that verifies that all when mocks are called #10

Closed BeniRupp closed 7 months ago

BeniRupp commented 8 months ago

Inspired by verifyAllWhenMocksCalled of jest-when.

BeniRupp commented 8 months ago

Thanks @mcous for your fast response and the interesting feedback!

Those are the use cases, why we do call verifyAllWhenMocksCalled() in a global afterEach hook in our project:

I agree with you, that a wrong implementation of the application should end in a red test because of a unfulfilled expectation. But it is very helpful to get a pointer, to why the output differs from the expected result.

So I think that function will provide a further possibility to verify that the application does work as expected and improves the development workflow.

mcous commented 7 months ago

@BeniRupp did you have any additional thoughts after my comments/review above? If not, I think I’m going to close this PR due to misalignment with project goals.

Regardless, I’m very happy to continue this conversation about more debugging capabilities!

BeniRupp commented 7 months ago

Hi @mcous, sorry, I did not find the time to work on that issue. So I have no additional ideas at the moment and it's fine for me to close this PR.

I let you know if I can figure out another debugging idea. 👍