Skip to content

Commit ea16594

Browse files
authored
Merge pull request #5789 from NomicFoundation/galargh/do-not-use-fetch
feat: add doNotUseFetch helper to the test utils
2 parents 5f26a5b + 6b68734 commit ea16594

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { after, before } from "node:test";
2+
3+
export function doNotUseFetch(): void {
4+
let originalFetch: typeof global.fetch;
5+
6+
before(async () => {
7+
originalFetch = global.fetch;
8+
global.fetch = async () => {
9+
throw new Error("Network requests are disabled");
10+
};
11+
});
12+
13+
after(async () => {
14+
global.fetch = originalFetch;
15+
});
16+
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from "./fixture-projects.js";
2-
export * from "./hardhat-error.js";
32
export * from "./fs.js";
3+
export * from "./global.js";
4+
export * from "./hardhat-error.js";

0 commit comments

Comments
 (0)