-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
jest.pages.config.ts
26 lines (25 loc) · 881 Bytes
/
jest.pages.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
import type { JestConfigWithTsJest } from "ts-jest";
// jest.config.mjs
import nextJest from "next/jest.js";
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});
const jestConfig: JestConfigWithTsJest = {
clearMocks: true,
coverageProvider: "v8",
preset: "ts-jest/presets/js-with-ts",
setupFiles: ["dotenv/config"],
transform: {
"^.+\\.mjs$": "ts-jest",
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testEnvironment: "jest-environment-jsdom",
moduleNameMapper: {
"^~/(.*)$": "<rootDir>/src/$1",
"^lib/(.*)$": "<rootDir>/common/$1",
},
testMatch: ["**/__tests__/**/*.test.tsx"],
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
export default createJestConfig(jestConfig as any);