Skip to content

Commit d7e0776

Browse files
committed
feat: implement new hardReset method
1 parent 2d26e02 commit d7e0776

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/fetch-mock/src/FetchMock.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { MatcherDefinition, RouteMatcher } from './Matchers.js';
44
import CallHistory from './CallHistory.js';
55
import * as requestUtils from './RequestUtils.js';
66

7+
export type HardResetOptions = {
8+
includeSticky?: boolean;
9+
}
10+
711
export type FetchMockGlobalConfig = {
812
includeContentLength?: boolean;
913
matchPartialBody?: boolean;
@@ -146,6 +150,13 @@ export class FetchMock {
146150
return this;
147151
}
148152

153+
hardReset(options?: HardResetOptions): FetchMock {
154+
this.clearHistory();
155+
this.removeRoutes(options as RemoveRouteOptions);
156+
this.unmockGlobal();
157+
return this;
158+
}
159+
149160
spy(
150161
this: FetchMock,
151162
matcher?: RouteMatcher | UserRouteConfig,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy