40 lines
1021 B
TypeScript
40 lines
1021 B
TypeScript
import type { Config } from 'jest';
|
|
|
|
const config: Config = {
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
roots: ['<rootDir>/src'],
|
|
testMatch: [
|
|
'**/__tests__/**/*.test.ts',
|
|
'**/__tests__/**/*.spec.ts',
|
|
'**/__tests__/**/*.e2e.ts',
|
|
'**/?(*.)+(spec|test).ts'
|
|
],
|
|
collectCoverageFrom: [
|
|
'src/**/*.ts',
|
|
'!src/**/*.d.ts',
|
|
'!src/main.ts',
|
|
'!src/config/**/*.ts',
|
|
'!src/**/*.config.ts'
|
|
],
|
|
coverageDirectory: 'coverage',
|
|
coverageReporters: ['text', 'lcov', 'html'],
|
|
coverageThreshold: {
|
|
global: {
|
|
branches: 70,
|
|
functions: 70,
|
|
lines: 70,
|
|
statements: 70
|
|
}
|
|
},
|
|
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setupTests.ts'],
|
|
testTimeout: 10000,
|
|
// EN: Clear mocks between tests to avoid state leakage
|
|
// VI: Xóa mocks giữa các test để tránh rò rỉ state
|
|
clearMocks: true,
|
|
// EN: Reset modules between tests for isolation
|
|
// VI: Reset modules giữa các test để cô lập
|
|
resetModules: true
|
|
};
|
|
|
|
export default config; |