Hey @ram5607, sorry for taking so long to get back to you. I have not given the library and its consumers the attention it deserves. As mentioned within the documentation, the resetHandlers function resets request handlers to the initial list given to the createWorker call. Another way to put this is that if you have added any additional mock handlers via worker.use() within a specific test, you can use resetMocks to clear those additional mock handlers. If you want to use different set of mock handlers instead of those provided to createWorkerFixture call, then these can be provided via rest parameters.
Hey @ram5607, sorry for taking so long to get back to you. I have not given the library and its consumers the attention it deserves. As mentioned within the documentation, the
resetHandlers
function resets request handlers to the initial list given to the createWorker call. Another way to put this is that if you have added any additional mock handlers viaworker.use()
within a specific test, you can useresetMocks
to clear those additional mock handlers. If you want to use different set of mock handlers instead of those provided tocreateWorkerFixture
call, then these can be provided via rest parameters.As of playwright-msw@2.0.0, I've introduced an integration test that shows how
resetHandlers
can be used: https://github.com/valendres/playwright-msw/blob/06011c71c2dac35e7c950fad721102b4bd5530c0/packages/example/tests/playwright/specs/rest.spec.ts#L27-L40There are now also a lot of unit tests that should help understand how the
resetHandlers
function behaves: https://github.com/valendres/playwright-msw/blob/4df2fe1c0651ad925bde7744b36ccc14b3e6cafc/packages/playwright-msw/src/router.test.ts#L186-L435If this is still unclear or you have any recommendations for what can be done to improve the documentation, please let me know!