-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjest.config.cjs
30 lines (27 loc) · 939 Bytes
/
jest.config.cjs
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
const nextJest = require("next/jest");
const createJestConfig = nextJest({
dir: "./",
});
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testEnvironment: "jest-environment-jsdom",
transform: {
"^.+\\.jsx?$": "babel-jest",
},
moduleNameMapper: {
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
"^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$":
"<rootDir>/__mocks__/file-mock.js",
},
moduleDirectories: ["node_modules", "src"],
transformIgnorePatterns: ["/node_modules/(?!remark-gfm).+\\.js$"],
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
testPathIgnorePatterns: [
"<rootDir>/.next/",
"<rootDir>/node_modules/",
"<rootDir>/cypress/",
],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig);