UNPKG

@fetch-mock/jest

Version:
33 lines (32 loc) 993 B
import { FetchMock } from 'fetch-mock'; import './jest-extensions.js'; import type { Jest } from '@jest/environment'; import type { FetchMockMatchers } from './types.js'; export { FetchMockMatchers } from './types.js'; type MockResetOptions = { includeSticky: boolean; }; declare class FetchMockJest extends FetchMock { mockClear(): this; mockReset(options?: MockResetOptions): this; mockRestore(options?: MockResetOptions): this; } export declare function manageFetchMockGlobally(jest: Jest): void; declare const fetchMockJest: FetchMockJest; export default fetchMockJest; declare global { namespace jest { interface Expect { (actual: FetchMock): FetchMockMatchers & { not: FetchMockMatchers; }; (actual: typeof fetch): FetchMockMatchers & { not: FetchMockMatchers; }; } } } declare module '@jest/expect' { interface Matchers<R> extends FetchMockMatchers<R> { } }