|
1 | 1 | module.exports = { |
| 2 | + testEnvironment: "jsdom", |
2 | 3 | collectCoverageFrom: [ |
3 | 4 | "**/*.{js,jsx,ts,tsx}", |
4 | 5 | "!**/*.d.ts", |
5 | 6 | "!**/node_modules/**", |
| 7 | + "!**/.next/**/*", |
| 8 | + "!**/coverage/**/*", |
| 9 | + "!*.config.js", |
| 10 | + "!components/**/index.ts", |
6 | 11 | ], |
7 | 12 | moduleNameMapper: { |
8 | | - /* Handle CSS imports (with CSS modules) |
9 | | - https://jestjs.io/docs/webpack#mocking-css-modules */ |
10 | 13 | "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy", |
11 | | - |
12 | | - // Handle CSS imports (without CSS modules) |
13 | | - "^.+\\.(css|sass|scss)$": "<rootDir>/__mocks__/styleMock.js", |
14 | | - |
15 | | - /* Handle image imports |
16 | | - https://jestjs.io/docs/webpack#handling-static-assets */ |
17 | 14 | "^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$": |
18 | 15 | "<rootDir>/__mocks__/fileMock.js", |
| 16 | + "next/link": require.resolve("./__mocks__/Link.tsx"), |
| 17 | + "^@test(/.*)$": "<rootDir>/test$1", |
19 | 18 | }, |
20 | 19 | setupFilesAfterEnv: ["./jest.setup.ts"], |
21 | 20 | testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/.next/"], |
22 | 21 | testEnvironment: "jsdom", |
23 | 22 | transform: { |
24 | | - /* Use babel-jest to transpile tests with the next/babel preset |
25 | | - https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object */ |
26 | 23 | "^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }], |
27 | 24 | }, |
28 | 25 | transformIgnorePatterns: [ |
|
0 commit comments