-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
47 lines (44 loc) · 1.33 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
import type { InitialOptionsTsJest } from "ts-jest/dist/types";
import { jsWithTsESM as tsjPreset } from "ts-jest/presets";
const { pathsToModuleNameMapper } = require("ts-jest/utils");
const { compilerOptions } = require("./tsconfig");
const config: InitialOptionsTsJest = {
collectCoverage: true,
collectCoverageFrom: [
"<rootDir>/src/**/*.{ts,tsx}",
"!<rootDir>/src/__tests__/**/*",
"!<rootDir>/src/*.d.ts",
],
// @ts-ignore: Unreachable code error
coverageReporters: ["text", "text-summary", "jest-badges"],
coverageThreshold: {
global: {
branches: 66,
functions: 72,
lines: 77,
statements: 77,
},
},
moduleDirectories: [
"<rootDir>/node_modules",
"<rootDir>",
"<rootDir>/src/__tests__",
],
preset: "ts-jest",
restoreMocks: true,
resetMocks: true,
resetModules: true,
setupFiles: ["<rootDir>/.jest/setupFiles.ts"],
transform: {
...tsjPreset.transform,
"^.+\\.(ts|tsx|js|jsx)": "ts-jest",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/src/__tests__/fixtures/fileTransformer.ts",
},
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>/",
}),
testEnvironment: "jsdom",
testPathIgnorePatterns: ["node_modules", "fixtures"],
};
export default config;