mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-04 15:55:44 +03:00
c5349291c8
Split from https://github.com/twentyhq/twenty/pull/4518 - Setup `@ui/*` as an internal alias to reference `twenty-ui/src`. - Configures twenty-front to understand the `@ui/*` alias on development mode, so twenty-ui can be hot reloaded. - When building on production mode, twenty-front needs twenty-ui to be built beforehand (which is automatic with the `dependsOn` option). - Configures twenty-front to understand the `@ui/*` alias when launching tests, so there is no need to re-build twenty-ui for tests. --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
/* eslint-disable @nx/enforce-module-boundaries,import/no-relative-packages */
|
|
import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest';
|
|
|
|
import { compilerOptions as twentyUiCompilerOptions } from '../twenty-ui/tsconfig.json';
|
|
|
|
import { compilerOptions } from './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: {
|
|
...pathsToModuleNameMapper(compilerOptions.paths),
|
|
// Include internal library aliases, so there is no need to build the library before tests.
|
|
...pathsToModuleNameMapper(twentyUiCompilerOptions.paths),
|
|
'\\.(jpg|jpeg|png|gif|webp|svg|svg\\?react)$':
|
|
'<rootDir>/__mocks__/imageMock.js',
|
|
'\\.css$': '<rootDir>/__mocks__/styleMock.js',
|
|
},
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
coverageThreshold: {
|
|
global: {
|
|
statements: 65,
|
|
lines: 65,
|
|
functions: 55,
|
|
},
|
|
},
|
|
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;
|