2024-10-19 07:48:30 +03:00
|
|
|
import type { Config } from 'jest';
|
|
|
|
import { defaults } from 'jest-config';
|
|
|
|
|
|
|
|
const config: Config = {
|
|
|
|
clearMocks: true,
|
|
|
|
collectCoverage: true,
|
2024-10-19 08:44:11 +03:00
|
|
|
collectCoverageFrom: [
|
|
|
|
"src/components/**/*.{js,jsx,ts,tsx}", // Include all components
|
2024-10-19 10:28:37 +03:00
|
|
|
"src/pages/**/*.{js,jsx,ts,tsx}",
|
2024-10-19 08:44:11 +03:00
|
|
|
"!src/**/*.test.{js,jsx,ts,tsx}", // Exclude test files
|
|
|
|
"!src/**/index.{js,jsx,ts,tsx}", // Optionally exclude index files
|
|
|
|
],
|
2024-10-19 07:48:30 +03:00
|
|
|
coverageDirectory: "coverage",
|
|
|
|
coverageProvider: "v8",
|
|
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
|
|
testEnvironment: "jsdom",
|
2024-10-19 10:13:06 +03:00
|
|
|
// transform: {
|
|
|
|
// '^.+\\.(ts|tsx|js|jsx)$': 'babel-jest',
|
|
|
|
// },
|
2024-10-19 10:48:21 +03:00
|
|
|
moduleNameMapper: {
|
|
|
|
"^@/src/(.*)$": "<rootDir>/src/$1", // Map '@/src' to the 'src' folder
|
|
|
|
"^src/(.*)$": "<rootDir>/src/$1", // Map 'src' to the 'src' folder
|
2024-10-19 10:57:44 +03:00
|
|
|
"\\.(svg|png|jpg|jpeg|gif)$": "<rootDir>/__mocks__/fileMock.js", // Add this line
|
2024-10-19 10:48:21 +03:00
|
|
|
},
|
2024-10-19 07:48:30 +03:00
|
|
|
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx', 'js', 'jsx'],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default config;
|