Skip to content

Commit

Permalink
feat: implement new hardReset method
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Nov 15, 2024
1 parent 2d26e02 commit d7e0776
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/fetch-mock/src/FetchMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { MatcherDefinition, RouteMatcher } from './Matchers.js';
import CallHistory from './CallHistory.js';
import * as requestUtils from './RequestUtils.js';

export type HardResetOptions = {
includeSticky?: boolean;
}

export type FetchMockGlobalConfig = {
includeContentLength?: boolean;
matchPartialBody?: boolean;
Expand Down Expand Up @@ -146,6 +150,13 @@ export class FetchMock {
return this;
}

hardReset(options?: HardResetOptions): FetchMock {
this.clearHistory();
this.removeRoutes(options as RemoveRouteOptions);
this.unmockGlobal();
return this;
}

spy(
this: FetchMock,
matcher?: RouteMatcher | UserRouteConfig,
Expand Down

0 comments on commit d7e0776

Please sign in to comment.