-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
33 lines (30 loc) · 934 Bytes
/
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
const path = require("path");
const { pathsToModuleNameMapper } = require("ts-jest");
const fs = require("fs");
const jsonc = require("jsonc-parser");
const tsconfigPath = path.resolve(__dirname, "./tsconfig.json");
const tsconfigContent = fs.readFileSync(tsconfigPath, "utf8");
const compilerOptions = jsonc.parse(tsconfigContent).compilerOptions;
const config = {
testEnvironment: "jsdom",
transformIgnorePatterns: ["node_modules/(?!(@fluentui/react-icons)/)"],
verbose: true,
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
moduleFileExtensions: ["ts", "tsx", "js"],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>/",
}),
testMatch: ["**/tests.{ts,tsx}"],
collectCoverage: true,
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
tsconfig: "./tsconfig.json",
useESM: true,
},
],
},
preset: "ts-jest",
};
export default config;