59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import type { Config } from 'jest';
|
|
|
|
const config: Config = {
|
|
moduleFileExtensions: ['js', 'json', 'ts'],
|
|
rootDir: '.',
|
|
roots: ['<rootDir>/src', '<rootDir>/../../features'],
|
|
testRegex: '.*\\.spec\\.ts$',
|
|
transform: {
|
|
'^.+\\.ts$': [
|
|
'@swc/jest',
|
|
{
|
|
jsc: {
|
|
parser: { syntax: 'typescript', decorators: true },
|
|
transform: { legacyDecorator: true, decoratorMetadata: true },
|
|
target: 'es2022',
|
|
},
|
|
},
|
|
],
|
|
'^.+\\.js$': [
|
|
'@swc/jest',
|
|
{
|
|
jsc: {
|
|
parser: { syntax: 'ecmascript' },
|
|
target: 'es2022',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
moduleNameMapper: {
|
|
'^@features/(.*)$': '<rootDir>/../../features/$1',
|
|
'^@common/(.*)$': '<rootDir>/src/common/$1',
|
|
'^@life-platform/shared$': '<rootDir>/../../@packages/shared/src/index.ts',
|
|
'^@life-platform/sms-templates$': '<rootDir>/../../features/sms/@packages/@templates/src/index.ts',
|
|
'^@life-platform/sms-protocol-imessage$': '<rootDir>/../../features/sms/@packages/@protocols/imessage/src/index.ts',
|
|
'^@lilith/typeorm-pgcrypto$': '<rootDir>/src/__mocks__/typeorm-pgcrypto.ts',
|
|
'^@lilith/typeorm-entities$': '<rootDir>/src/__mocks__/typeorm-entities.ts',
|
|
'^@lilith/ml-feedback$': '<rootDir>/src/__mocks__/ml-feedback.ts',
|
|
'^@lilith/flight-recorder$': '<rootDir>/src/__mocks__/flight-recorder.ts',
|
|
'^@test-helpers/(.*)$': '<rootDir>/src/__mocks__/$1',
|
|
},
|
|
collectCoverageFrom: [
|
|
'src/**/*.ts',
|
|
'../../features/*/backend/**/*.ts',
|
|
'!**/*.module.ts',
|
|
'!**/main.ts',
|
|
'!**/index.ts',
|
|
'!**/*.dto.ts',
|
|
'!**/*.entity.ts',
|
|
],
|
|
coverageDirectory: './coverage',
|
|
resolver: '<rootDir>/jest-resolver.cjs',
|
|
testEnvironment: 'node',
|
|
setupFiles: ['./src/test-setup.ts'],
|
|
transformIgnorePatterns: [
|
|
'node_modules/(?!.*@lilith)',
|
|
],
|
|
};
|
|
|
|
export default config;
|