Skip to content

Commit 3cad78e

Browse files
author
Griko Nibras
authored
chore: sync staging → main (#122)
2 parents 900e1d7 + 9f869ee commit 3cad78e

40 files changed

Lines changed: 14857 additions & 28329 deletions

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"simple-import-sort/exports": "warn",
1212
"simple-import-sort/imports": "warn"
1313
},
14-
"ignorePatterns": ["node_modules/", ".next/", "out/", "src/chains/"],
14+
"ignorePatterns": ["node_modules/", ".next/", "out/", "src/chains/*"],
1515
"overrides": [
1616
{
1717
"files": ["*.ts", "*.tsx"],

chain-registry

Submodule chain-registry updated 80 files

jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@ const createJestConfig = nextJest({
77
});
88

99
// Add any custom config to be passed to Jest
10+
/** @type {import('ts-jest').JestConfigWithTsJest} */
1011
const customJestConfig = {
12+
preset: "ts-jest/presets/js-with-ts-esm",
13+
moduleNameMapper: {
14+
isows: "<rootDir>/node_modules/isows/_cjs/index.js", // https://github.com/wagmi-dev/viem/issues/1329
15+
tinykeys: "<rootDir>/node_modules/tinykeys/dist/tinykeys.js",
16+
},
17+
setupFiles: ["<rootDir>/jest.polyfills.js"],
1118
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
1219
testEnvironment: "jest-environment-jsdom",
1320
testPathIgnorePatterns: [
1421
"<rootDir>/.next/",
1522
"<rootDir>/node_modules/",
1623
"<rootDir>/tests/",
1724
],
25+
transform: {
26+
"^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }],
27+
},
28+
transformIgnorePatterns: [
29+
"node_modules/(?!isows/)", // https://github.com/wagmi-dev/viem/issues/1329
30+
],
1831
};
1932

2033
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async

jest.polyfills.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// https://mswjs.io/docs/faq/#referenceerror-fetch-is-not-defined-in-nodejs
2+
// https://mswjs.io/docs/faq/#requestresponsetextencoder-is-not-defined-jest
3+
4+
const { ReadableStream } = require("stream/web");
5+
const { clearImmediate, setImmediate } = require("timers");
6+
const { TextDecoder, TextEncoder } = require("util");
7+
8+
Object.defineProperties(global, {
9+
ReadableStream: { value: ReadableStream },
10+
TextDecoder: { value: TextDecoder },
11+
TextEncoder: { value: TextEncoder },
12+
clearImmediate: { value: clearImmediate },
13+
setImmediate: { value: setImmediate },
14+
});
15+
16+
const { Blob, File } = require("buffer");
17+
const { fetch, FormData, Headers, Request, Response } = require("undici");
18+
19+
Object.defineProperties(global, {
20+
Blob: { value: Blob },
21+
File: { value: File },
22+
FormData: { value: FormData },
23+
Headers: { value: Headers },
24+
Request: { value: Request },
25+
ResizeObserver: { value: require("resize-observer-polyfill") },
26+
Response: { value: Response },
27+
fetch: { value: fetch, writable: true },
28+
});

jest.setup.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import "@testing-library/jest-dom/extend-expect";
2-
3-
global.ResizeObserver = require("resize-observer-polyfill");
4-
5-
// eslint-disable-next-line @typescript-eslint/no-var-requires
6-
global.TextEncoder = require("util").TextEncoder;
1+
import "@testing-library/jest-dom";
72

83
// suppress zustand deprecation notice to clear out logs
94
global.console.warn = (...args) =>

0 commit comments

Comments
 (0)