jest.config.cjs•1.25 kB
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
// Meta tests are excluded from regular test runs
// They analyze test quality and are expected to fail when finding issues
// Run them separately with: npm run test:meta
testPathIgnorePatterns: [
'/node_modules/',
'/tests/meta/test-quality.test.ts'
],
transform: {
'^.+\\.ts$': ['ts-jest', {
tsconfig: {
esModuleInterop: true,
allowSyntheticDefaultImports: true,
},
}],
},
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/index.ts',
],
coverageThreshold: {
global: {
branches: 90,
functions: 90,
lines: 90,
statements: 90,
},
},
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
clearMocks: true,
testTimeout: 10000,
setupFilesAfterEnv: [
'jest-plugin-must-assert'
],
reporters: [
'default',
['jest-junit', {
outputDirectory: 'test-results',
outputName: 'junit.xml',
}]
],
};