-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjest.config.ts
More file actions
47 lines (44 loc) · 1.44 KB
/
jest.config.ts
File metadata and controls
47 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type { Config } from "jest";
import nextJest from "next/jest.js";
const createJestConfig = nextJest({
dir: "./",
});
// Add any custom config to be passed to Jest
const customJestConfig: Config = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
testEnvironment: "jsdom",
verbose: true,
coverageThreshold: {
global: {
branches: 60,
functions: 60,
lines: 60,
statements: 60,
},
},
testPathIgnorePatterns: ["/node_modules/", "/.next/", "/dist/"],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"^@/components/(.*)$": "<rootDir>/src/components/$1",
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"jest-transform-stub",
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
transformIgnorePatterns: [
"node_modules/(?!(wagmi|viem|@wagmi|@tanstack|lucide-react|@radix-ui|@react-spring|abitype|@adraffy|@noble|@scure)/)",
],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
},
moduleFileExtensions: ["js", "jsx", "ts", "tsx", "json"],
testMatch: [
"<rootDir>/src/**/__tests__/**/*.(js|jsx|ts|tsx)",
"<rootDir>/src/**/?(*.)(spec|test).(js|jsx|ts|tsx)",
],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(customJestConfig);