Files
novalon-website/jest.config.js
T
张翔 9c6a905788 fix: improve test coverage accuracy and fix session timestamp bug
- Exclude seed files from coverage (not business logic)
- Fix Date.now() double call bug in createSession functions
- Coverage improved: 53.13% → 54.18%
- All 122 test suites passing
2026-04-09 18:06:02 +08:00

44 lines
1.0 KiB
JavaScript

module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>/src'],
testMatch: ['**/__tests__/**/*.test.{ts,tsx}', '**/*.test.{ts,tsx}'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{ts,tsx}',
'!src/**/__tests__/**',
'!src/db/seed*.ts',
],
coverageThreshold: {
global: {
branches: 50,
functions: 55,
lines: 60,
statements: 60,
},
},
coverageReporters: ['text', 'lcov', 'html', 'json'],
coverageDirectory: 'coverage',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(nanoid|next-auth|@auth)/)',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testTimeout: 10000,
verbose: true,
maxWorkers: '50%',
cacheDirectory: '/tmp/jest-cache',
};