2024-04-04 16:38:01 +03:00
|
|
|
import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest';
|
|
|
|
|
2024-04-17 19:06:02 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const tsConfig = require('./tsconfig.json');
|
2024-10-05 01:22:38 +03:00
|
|
|
process.env.TZ = 'GMT';
|
2024-04-04 16:38:01 +03:00
|
|
|
|
|
|
|
const jestConfig: JestConfigWithTsJest = {
|
2024-03-05 19:43:31 +03:00
|
|
|
// to enable logs, comment out the following line
|
|
|
|
silent: true,
|
2024-04-04 16:38:01 +03:00
|
|
|
displayName: 'twenty-front',
|
|
|
|
preset: '../../jest.preset.js',
|
|
|
|
setupFilesAfterEnv: ['./setupTests.ts'],
|
2024-01-11 10:51:36 +03:00
|
|
|
testEnvironment: 'jsdom',
|
2024-04-04 16:38:01 +03:00
|
|
|
transformIgnorePatterns: ['../../node_modules/'],
|
2023-12-10 18:22:43 +03:00
|
|
|
transform: {
|
2024-01-11 10:51:36 +03:00
|
|
|
'^.+\\.(ts|js|tsx|jsx)$': '@swc/jest',
|
2023-12-10 18:22:43 +03:00
|
|
|
},
|
|
|
|
moduleNameMapper: {
|
2024-01-12 20:05:56 +03:00
|
|
|
'\\.(jpg|jpeg|png|gif|webp|svg|svg\\?react)$':
|
|
|
|
'<rootDir>/__mocks__/imageMock.js',
|
2024-03-31 11:53:37 +03:00
|
|
|
'\\.css$': '<rootDir>/__mocks__/styleMock.js',
|
2024-04-17 19:06:02 +03:00
|
|
|
...pathsToModuleNameMapper(tsConfig.compilerOptions.paths),
|
2023-12-10 18:22:43 +03:00
|
|
|
},
|
2024-04-04 16:38:01 +03:00
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
2023-12-10 18:22:43 +03:00
|
|
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
2023-12-14 22:08:03 +03:00
|
|
|
coverageThreshold: {
|
|
|
|
global: {
|
2024-10-24 17:59:59 +03:00
|
|
|
statements: 58,
|
2024-10-05 01:22:38 +03:00
|
|
|
lines: 55,
|
2024-10-24 17:59:59 +03:00
|
|
|
functions: 47,
|
2023-12-14 22:08:03 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
|
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
'states/.+State.ts$',
|
2024-01-11 10:51:36 +03:00
|
|
|
'states/selectors/*',
|
2023-12-14 22:08:03 +03:00
|
|
|
'contexts/.+Context.ts',
|
|
|
|
'testing/*',
|
|
|
|
'tests/*',
|
|
|
|
'config/*',
|
|
|
|
'graphql/queries/*',
|
|
|
|
'graphql/mutations/*',
|
|
|
|
'graphql/fragments/*',
|
|
|
|
'types/*',
|
|
|
|
'constants/*',
|
|
|
|
'generated-metadata/*',
|
|
|
|
'generated/*',
|
|
|
|
'__stories__/*',
|
2024-01-11 10:51:36 +03:00
|
|
|
'display/icon/index.ts',
|
2023-12-14 22:08:03 +03:00
|
|
|
],
|
2024-04-04 16:38:01 +03:00
|
|
|
coverageDirectory: './coverage',
|
2024-01-11 10:51:36 +03:00
|
|
|
};
|
2024-04-04 16:38:01 +03:00
|
|
|
|
|
|
|
export default jestConfig;
|