-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
63 lines (58 loc) · 1.67 KB
/
jest.config.ts
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
59
60
61
62
63
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 config: Config = {
globals: { TextEncoder: TextEncoder, TextDecoder: TextDecoder },
testEnvironment: "jsdom",
testEnvironmentOptions: {
customExportConditions: [""],
},
moduleNameMapper: {
"^@/(.*)$": "./src/$1",
"^@/messages/(.*)$": "./messages/$1",
"uuid": require.resolve('uuid'),
},
setupFiles: ["./jest.polyfills.ts"],
// Add more setup options before each test is run
setupFilesAfterEnv: ["./jest.setup.ts"],
collectCoverageFrom: [
"src/**/*.tsx",
"src/**/*.ts",
"!src/**/*.d.ts",
"!src/i18n.ts",
"!src/middleware.ts",
"!src/_app/providers/providersServer.tsx",
"!src/_app/providers/providersClient.tsx",
"!src/**/index.ts",
"!src/**/__test__/*", // если не нужно собирать покрытие с самих тестов
],
coverageProvider: "v8",
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
},
},
collectCoverage: true,
// coverageReporters: ["json"],
// coverageReporters: ["json", "html"],
coverageReporters: ["text", "cobertura"],
reporters: [
"default",
"jest-junit",
// [
// "jest-html-reporter",
// {
// outputPath: "./reports/test-report.html",
// pageTitle: "Automation Test with askui",
// includeFailureMsg: true,
// },
// ],
],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);