-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
31 lines (26 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
// jest.config.ts
import type { Config } from "@jest/types";
import nextJest from "next/jest";
// Sync object
const customJestConfig: Config.InitialOptions = {
verbose: true,
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/"],
setupFiles: ["<rootDir>/.jest/setEnvVars.ts"],
setupFilesAfterEnv: ["<rootDir>/.jest/setupTests.ts"],
moduleDirectories: ["node_modules", "<rootDir>"],
testEnvironment: "jest-environment-jsdom",
transformIgnorePatterns: ["<rootDir>/node_modules/(?!isbot|jest-dom)"],
preset: "ts-jest",
};
// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: "./" })(customJestConfig);
module.exports = async () => {
// Create Next.js jest configuration presets
const jestConfig = await createJestConfig();
// Custom `moduleNameMapper` configuration
const moduleNameMapper = {
...jestConfig.moduleNameMapper,
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
};
return { ...jestConfig, moduleNameMapper, testTimeout: 20000 };
};