-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
42 lines (40 loc) · 1.45 KB
/
jest.config.js
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
38
39
40
41
42
const nextJest = require("next/jest");
const createJestConfig = nextJest({
dir: "./",
});
const customJestConfig = {
roots: ['<rootDir>'],
transform: {
'^.+\\.ts?$': 'ts-jest'
},
// testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$',
moduleFileExtensions: ['ts', 'js', 'tsx', 'jsx', 'json', 'node'],
clearMocks: true,
coverageDirectory: 'coverage',
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!<rootDir>/src/*.{js,jsx,ts,tsx}',
'!<rootDir>/src/**/*mock*.{js,jsx,ts,tsx}',
'!<rootDir>/src/styles/**/*.{js,jsx,ts,tsx}',
'!<rootDir>/src/config/**/*.{js,jsx,ts,tsx}',
'!<rootDir>/src/pages/**/*.{js,jsx,ts,tsx}',
'!<rootDir>/**/stories.{js,jsx,ts,tsx}',
'!<rootDir>/src/templates/**/*.{js,jsx,ts,tsx}',
'!<rootDir>/node_modules/',
],
testPathIgnorePatterns: ['/node_modules/', '/.next/', '/.out/', '/public/'],
preset: 'ts-jest',
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
setupFilesAfterEnv: ['<rootDir>/.jest/setupTests.ts'],
moduleDirectories: ["node_modules", "<rootDir>/"],
// testEnvironment: "jest-environment-jsdom",
testEnvironment: 'jsdom',
// testEnvironment: 'node',
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': 'identity-obj-proxy',
},
};
module.exports = createJestConfig(customJestConfig);