-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
28 lines (26 loc) · 993 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
import type { Config } from '@jest/types';
const config: Config.InitialOptions = {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': '<rootDir>/jest.mock.css.ts'
},
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}', // Collect coverage from all TypeScript files in the src directory
'!src/**/*.d.ts', // Exclude type definition files
'!src/**/index.ts', // Exclude index files if needed
'!src/**/*.stories.tsx', // Exclude storybook files if any
'!src/**/__tests__/**', // Exclude test files
'!src/**/tests/**', // Exclude test-related directories
],
testEnvironment: 'jsdom',
};
export default config;