Skip to main content
Module

x/mock_fetch/mod.ts>install

An extremely simple way to mock globalThis.fetch responses
Latest
variable install
import { install } from "https://deno.land/x/mock_fetch@0.3.0/mod.ts";

Replace globalThis.fetch with mockedFetch (or another function that matches the fetch signature)

To restore the original globalThis.fetch, call uninstall().

type

(replacement?: fetch) => unknown