Something went wrong. Try again.
Web client for TLE Community.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647const config = { // A list of paths to directories that Jest should use to search for files in // https://jestjs.io/docs/configuration#roots-arraystring roots: ['<rootDir>/app/'],
// The test environment that will be used for testing, jsdom for browser environment // https://jestjs.io/docs/configuration#testenvironment-string testEnvironment: 'jsdom',
// Jest transformations // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object transform: { '^.+\\.tsx?$': 'ts-jest', // Transform TypeScript files using ts-jest },
// A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed // https://jestjs.io/docs/configuration#setupfilesafterenv-array setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
// Code coverage config // https://jestjs.io/docs/configuration#collectcoveragefrom-array coverageDirectory: '<rootDir>/coverage/', collectCoverageFrom: ['<rootDir>/app/**/*.{ts,tsx}', '!**/node_modules/**', '!**/*.d.ts'],
// Important: order matters, specific rules should be defined first // https://jestjs.io/fr/docs/configuration#modulenamemapper-objectstring-string--arraystring moduleNameMapper: { // Style imports have no meaning under Jest '\\.(css|scss|sass)$': '<rootDir>/app/__mocks__/styleMock.ts',
// react-markdown is ESM-only and cannot be required by Jest's CommonJS runtime '^react-markdown$': '<rootDir>/app/__mocks__/reactMarkdown.tsx',
// app/hmr.ts uses import.meta.hot, which TypeScript refuses to compile to the CommonJS // module ts-jest forces for Jest (TS1343); swap in the no-op mock instead '^app/hmr$': '<rootDir>/app/__mocks__/hmr.ts',
// app/ absolute module alias 'app/(.*)': '<rootDir>/app/$1', },
testTimeout: 30000, clearMocks: true,};
export default config;