Repository navigation
Expand file tree
/
Copy pathjest.config.js
More file actions
58 lines (52 loc) · 1.59 KB
/
Copy pathjest.config.js
File metadata and controls
58 lines (52 loc) · 1.59 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
48
49
50
51
52
53
54
55
56
57
58
/** @type {import('jest').Config} */
const config = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
// Use babel-jest for transformation with dedicated test babel config
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { configFile: "./babel.test.config.js" }],
},
// Module name mapper for CSS modules, static assets, path alias, and ESM-only libs
moduleNameMapper: {
"^.+\\.(css|scss|sass|less)$": "identity-obj-proxy",
"^.+\\.(png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot)$":
"<rootDir>/__mocks__/fileMock.js",
"^@/(.*)$": "<rootDir>/$1",
// Stub ESM-only packages that babel-jest cannot transpile
"^react-markdown$": "<rootDir>/__mocks__/react-markdown.js",
"^remark-gfm$": "<rootDir>/__mocks__/remark-gfm.js",
"^rehype-.*$": "<rootDir>/__mocks__/fileMock.js",
},
// Test file discovery
testMatch: [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)",
],
// Ignore e2e (Playwright), Next.js build artefacts, and helper files
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/.next/",
"<rootDir>/e2e/",
"<rootDir>/__tests__/helpers/",
],
// Coverage
collectCoverageFrom: [
"components/**/*.{ts,tsx}",
"lib/**/*.{ts,tsx}",
"app/**/*.{ts,tsx}",
"!app/layout.tsx",
"!**/*.d.ts",
"!**/node_modules/**",
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
coverageReporters: ["text", "lcov", "html"],
coverageDirectory: "coverage",
};
module.exports = config;