-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.ts
More file actions
58 lines (55 loc) · 1.69 KB
/
jest.config.ts
File metadata and controls
58 lines (55 loc) · 1.69 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
import type { Config } from "jest";
import nextJest from "next/jest.js";
const createJestConfig = nextJest({
dir: "./",
});
const config: Config = {
verbose: true,
projects: [
{
displayName: "client",
clearMocks: true,
testEnvironment: "jsdom",
testMatch: [
"**/tests/unit/**/*.+(test|spec).[jt]s?(x)",
"**/tests/integration/**/*.client.+(test|spec).[jt]s?(x)",
"**/*.client.+(test|spec).[jt]s?(x)",
],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testPathIgnorePatterns: [".*\\.server\\.(test|spec)\\.[jt]s?(x)$"],
},
{
displayName: "server",
clearMocks: true,
testEnvironment: "node",
testMatch: ["**/tests/integration/**/*.server.+(test|spec).[jt]s?(x)", "**/*.server.+(test|spec).[jt]s?(x)"],
testPathIgnorePatterns: [".*\\.client\\.(test|spec)\\.[jt]s?(x)$"],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
setupFilesAfterEnv: ["<rootDir>/jest.server.setup.ts"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
},
},
],
collectCoverage: true,
coverageDirectory: "coverage",
coverageReporters: ["html", ["text", { skipFull: true }], "text-summary"],
collectCoverageFrom: [
"components/**/*.{js,jsx,ts,tsx}",
"lib/**/*.{js,ts}",
"app/**/*.{js,jsx,ts,tsx}",
"!**/*.d.ts",
"!**/node_modules/**",
"!**/*.test.{js,jsx,ts,tsx}",
"!**/*.spec.{js,jsx,ts,tsx}",
],
};
export default createJestConfig(config);