29 lines
1017 B
TypeScript
29 lines
1017 B
TypeScript
import type { Config } from 'jest';
|
|
import { defaults } from 'jest-config';
|
|
|
|
const config: Config = {
|
|
clearMocks: true,
|
|
collectCoverage: true,
|
|
collectCoverageFrom: [
|
|
"src/components/**/*.{js,jsx,ts,tsx}", // Include all components
|
|
"src/pages/**/*.{js,jsx,ts,tsx}",
|
|
"!src/**/*.test.{js,jsx,ts,tsx}", // Exclude test files
|
|
"!src/**/index.{js,jsx,ts,tsx}", // Optionally exclude index files
|
|
],
|
|
coverageDirectory: "coverage",
|
|
coverageProvider: "v8",
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
testEnvironment: "jsdom",
|
|
// transform: {
|
|
// '^.+\\.(ts|tsx|js|jsx)$': 'babel-jest',
|
|
// },
|
|
moduleNameMapper: {
|
|
"^@/src/(.*)$": "<rootDir>/src/$1", // Map '@/src' to the 'src' folder
|
|
"^src/(.*)$": "<rootDir>/src/$1", // Map 'src' to the 'src' folder
|
|
"\\.(svg|png|jpg|jpeg|gif)$": "<rootDir>/__mocks__/fileMock.js", // Add this line
|
|
},
|
|
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx', 'js', 'jsx'],
|
|
};
|
|
|
|
export default config;
|