-
Notifications
You must be signed in to change notification settings - Fork 4
/
jest.config.js
44 lines (40 loc) · 1.18 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
const { pathsToModuleNameMapper } = require('ts-jest')
const nextJest = require('next/jest')
const { compilerOptions } = require('./tsconfig.json')
const createJestConfig = nextJest({
dir: './',
})
// Custom `moduleNameMapper` configuration
const paths = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
})
/** @type {import('ts-jest').JestConfigWithTsJest} */
const customJestConfig = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['json-summary', 'lcov', 'text', 'clover'],
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'config/**/*.{ts,tsx}',
'hooks/**/*.{ts,tsx}',
'layouts/**/*.{ts,tsx}',
'!**/node_modules/**',
'!**/vendor/**',
'!**/build/**',
'!**/dist/**',
'!**/coverage/**',
'!**/public/**',
'!**/utils/testing.ts',
'!**/utils/index.ts',
'!**/useVisibility.ts',
'!**/Header.tsx',
],
moduleDirectories: ['node_modules', '<rootDir>/'],
moduleNameMapper: {
...paths,
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['/cypress/'],
}
module.exports = createJestConfig(customJestConfig)