-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
36 lines (30 loc) · 1.17 KB
/
jest.config.js
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 nextJest from "next/jest.js";
import { pathsToModuleNameMapper } from "ts-jest";
import options from "./tsconfig.json" with { type: "json" };
const createJestConfig = nextJest({
dir: "./",
});
/** @type {import('jest').Config} */
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
moduleDirectories: ["node_modules", "<rootDir>/"],
testEnvironment: "jest-environment-jsdom",
displayName: {
name: "Tasks Frontend",
color: "blueBright",
},
modulePaths: [options.compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(options.compilerOptions.paths),
testPathIgnorePatterns: ["<rootDir>/.next", "<rootDir>/cypress"],
// Do not put anything here: it will be overwritten by createJestConfig
transformIgnorePatterns: [],
};
// based on https://stackoverflow.com/a/74903612
export default async function () {
const makeConfig = await createJestConfig(customJestConfig);
const finalConfig = await makeConfig();
// Allow certain libraries to be transpiled with TS Jest
finalConfig.transformIgnorePatterns[0] =
"/node_modules/(?!react-dnd|dnd-core|@react-dnd|redux|@babel|@simplewebauthn)";
return finalConfig;
}