Skip to content

🚀 Feature Request: Export resetFetchMock from cloudflare:test #6391

@ericmatthys

Description

@ericmatthys

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestvitestRelating to the Workers Vitest integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions