-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjest.config.ts
More file actions
25 lines (23 loc) · 752 Bytes
/
Copy pathjest.config.ts
File metadata and controls
25 lines (23 loc) · 752 Bytes
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
import { pathsToModuleNameMapper } from "ts-jest";
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
// which contains the path mapping (ie the `compilerOptions.paths` option):
import { compilerOptions } from "./tsconfig.json";
import type { Config } from "jest";
const config: Config = {
preset: "ts-jest",
testEnvironment: "jest-environment-jsdom",
extensionsToTreatAsEsm: [".ts", ".tsx"],
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
},
],
// process `*.tsx` files with `ts-jest`
},
roots: ["<rootDir>/src"],
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
};
export default config;