generated from shouta0715/Nextjs-Product
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
37 lines (34 loc) · 953 Bytes
/
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
37
const nextJest = require("next/jest");
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 customJestConfig = {
collectCoverage: true,
coverageDirectory: "coverage",
moduleDirectories: ["node_modules", "<rootDir>/"],
testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"],
testPathIgnorePatterns: [
"<rootDir>/e2e/",
"<rootDir>/.next/",
"<rootDir>/node_modules/",
"<rootDir>/src/gql/",
],
testEnvironment: "jest-environment-jsdom",
setupFilesAfterEnv: ["./jest.setup.ts"],
globalSetup: "<rootDir>/__mocks__/setupEnv.ts",
moduleNameMapper: {
"^.+\\.(svg)$": "<rootDir>/__mocks__/svg.tsx",
},
reporters: [
"default",
[
"jest-html-reporters",
{
publicPath: "__reports__",
filename: "jest.html",
},
],
],
};
export default createJestConfig(customJestConfig);