-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
enhancementNew feature or requestNew feature or requestvitestRelating to the Workers Vitest integrationRelating to the Workers Vitest integration
Description
Describe the solution
Currently, there is a function that can be imported from cloudflare:mock-agent called resetMockAgent. Importantly, this function resets the interceptors. Automatically, this is used to reset things for each file. If a single test file has multiple describes that set up their own interceptors, these can leak between describes (e.g. persist: true). A solution to this is to call resetMockAgent in afterEach.
However, @cloudflare/workers-types doesn't allow for importing this function without a TS error. It would be useful to have a supported function exported from cloudflare:test to reset interceptors between tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestvitestRelating to the Workers Vitest integrationRelating to the Workers Vitest integration