chore: configure jest coverage

This commit is contained in:
张翔
2026-03-24 13:30:52 +08:00
parent 99f9267bca
commit 707f125c14
2 changed files with 4 additions and 37 deletions
-36
View File
@@ -1,36 +0,0 @@
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__/**',
],
coverageThreshold: {
global: {
branches: 35,
functions: 45,
lines: 45,
statements: 45,
},
},
coverageReporters: ['text', 'lcov', 'html', 'json'],
coverageDirectory: 'coverage',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(nanoid|next-auth|@auth)/)',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testTimeout: 10000,
verbose: true,
maxWorkers: '50%',
};
+1
View File
@@ -0,0 +1 @@
config/test/jest.config.js