-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjest.config.ts
36 lines (31 loc) · 1.06 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
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 { JestConfigWithTsJest } from "ts-jest";
const esModules = ["@hyperionbt/helios"].join("|");
const jestConfig: JestConfigWithTsJest = {
testEnvironment: "node",
roots: ["<rootDir>"],
extensionsToTreatAsEsm: [".ts"],
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/dist/"],
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: {
"(bignumber\\.js)": "$1",
"(.+)\\.[jt]sx?": "$1",
...pathsToModuleNameMapper(compilerOptions.paths, { useESM: true }),
},
transformIgnorePatterns: [`node_modules/(?!${esModules})`],
transform: {
"^.+\\.[tj]sx?$": [
"ts-jest",
{
tsconfig: "tsconfig.test.json",
isolatedModules: true,
useESM: true,
},
],
},
setupFiles: ["<rootDir>/tests/setup.ts"],
};
export default jestConfig;