-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
52 lines (50 loc) · 1.47 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
43
44
45
46
47
48
49
50
51
52
module.exports = {
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.jsx$': 'babel-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.jest.json',
},
],
},
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/src/**',
'<rootDir>/pages/**',
'!<rootDir>/pages/_app.tsx',
],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
},
},
coverageDirectory: 'jest-coverage',
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/server/',
'<rootDir>/__tests__/integration/',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
coverageReporters: ['text-summary', 'json', 'text', 'html', 'cobertura'],
moduleNameMapper: {
/* Handle CSS imports (with CSS modules)
https://jestjs.io/docs/webpack#mocking-css-modules */
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
// Handle CSS imports (without CSS modules)
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
/* Handle image imports
https://jestjs.io/docs/webpack#handling-static-assets */
'^.+\\.(jpg|jpeg|png|gif|webp|svg)$': '<rootDir>/__mocks__/fileMock.js',
'^@(Test)(.*)$': '<rootDir>/test/$2',
'^@(Server)(.*)$': '<rootDir>/server/$2',
'^@(Pages)(.*)$': '<rootDir>/pages/$2',
'^@([A-Z].*)$': '<rootDir>/src/$1',
},
preset: 'ts-jest/presets/js-with-babel',
};