twenty/packages/twenty-front/jest.config.ts
Charles Bochet d8c4af9279 Fix all broken CIs (#7439)
Fix all the broken CIs :p

This includes an ongoing effort to simplify test maintenance by having 1
unique source of truth about metadata and data mocks (that will later be
generated from a unique source of seeds: dev = demo = test)

Regressions:
- Unit line coverage: 60 > 55
- Storybook Pages branch coverage: 40 > 35
We will need to write tests to increase those coverage
- RelationFieldDisplay perf: 0.2ms to 0.22ms > We might have a
regression here
- Removed perf story about RawJSON > We will need to re-add it
2024-10-05 00:23:23 +02:00

55 lines
1.5 KiB
TypeScript

import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const tsConfig = require('./tsconfig.json');
process.env.TZ = 'GMT';
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: 60,
lines: 55,
functions: 50,
},
},
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;