-
-
Notifications
You must be signed in to change notification settings - Fork 731
Description
This would solve...
I'm migrating from nock to undici mocks and after each test, I clear all active mocks, so that they do not interact with other test cases. This solves the problem when mocks from a failed test might interact with other test cases, making debugging difficult.
The implementation should look like...
It would be great to be able to call a cleanMocks method on MockPool or MockAgent to clean all pending mocks.
I have also considered...
I have considered creating a separate MockAgent instance for every test case, but I'm not sure it's a good idea since it can have a performance overhead and a lof of boilerplate code for cleaning up the mock agent.
I also considered using .assertNoPendingInterceptors() after each test case, but it leads to all tests failing if any of them haven't used a mocked request.
Additional context
It's the same feature nock has.