twenty/packages/twenty-front/jest.config.ts
Félix Malfait f2cc385710
Fix frontend tests (#6585)
Fix a few broken tests
2024-08-09 08:38:01 +02:00

54 lines
1.4 KiB
TypeScript

import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const tsConfig = require('./tsconfig.json');
const jestConfig: JestConfigWithTsJest = {
// to enable logs, comment out the following line
silent: true,
displayName: 'twenty-front',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['./setupTests.ts'],
testEnvironment: 'jsdom',
transformIgnorePatterns: ['../../node_modules/'],
transform: {
'^.+\\.(ts|js|tsx|jsx)$': '@swc/jest',
},
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|webp|svg|svg\\?react)$':
'<rootDir>/__mocks__/imageMock.js',
'\\.css$': '<rootDir>/__mocks__/styleMock.js',
...pathsToModuleNameMapper(tsConfig.compilerOptions.paths),
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
coverageThreshold: {
global: {
statements: 62,
lines: 61,
functions: 52,
},
},
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
coveragePathIgnorePatterns: [
'states/.+State.ts$',
'states/selectors/*',
'contexts/.+Context.ts',
'testing/*',
'tests/*',
'config/*',
'graphql/queries/*',
'graphql/mutations/*',
'graphql/fragments/*',
'types/*',
'constants/*',
'generated-metadata/*',
'generated/*',
'__stories__/*',
'display/icon/index.ts',
],
coverageDirectory: './coverage',
};
export default jestConfig;