From 23c12787eb2770f38427c66ec7adb8eae3a38079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Sun, 29 Mar 2026 13:40:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=A1=86=E6=9E=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除冗余的config/test/jest.config.js - 将jest.config.js从符号链接改为独立配置文件 - 提升测试覆盖率阈值: - branches: 41% -> 50% - functions: 47% -> 55% - lines: 52% -> 60% - statements: 51% -> 60% - 添加Jest缓存目录配置优化CI性能 --- config/test/jest.config.js | 41 ------------------------------------ jest.config.js | 43 +++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 config/test/jest.config.js mode change 120000 => 100644 jest.config.js diff --git a/config/test/jest.config.js b/config/test/jest.config.js deleted file mode 100644 index 989dd54..0000000 --- a/config/test/jest.config.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'jsdom', - roots: ['/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: 41, - functions: 47, - lines: 52, - statements: 51, - }, - }, - coverageReporters: ['text', 'lcov', 'html', 'json'], - coverageDirectory: 'coverage', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - moduleNameMapper: { - '^@/(.*)$': '/src/$1', - }, - transform: { - '^.+\\.(ts|tsx)$': [ - 'ts-jest', - { - tsconfig: 'tsconfig.test.json', - }, - ], - }, - transformIgnorePatterns: [ - 'node_modules/(?!(nanoid|next-auth|@auth)/)', - ], - setupFilesAfterEnv: ['/jest.setup.js'], - testTimeout: 10000, - verbose: true, - maxWorkers: '50%', -}; \ No newline at end of file diff --git a/jest.config.js b/jest.config.js deleted file mode 120000 index 7f013e1..0000000 --- a/jest.config.js +++ /dev/null @@ -1 +0,0 @@ -config/test/jest.config.js \ No newline at end of file diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..409d9f0 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,42 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'jsdom', + roots: ['/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: 50, + functions: 55, + lines: 60, + statements: 60, + }, + }, + coverageReporters: ['text', 'lcov', 'html', 'json'], + coverageDirectory: 'coverage', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + moduleNameMapper: { + '^@/(.*)$': '/src/$1', + }, + transform: { + '^.+\\.(ts|tsx)$': [ + 'ts-jest', + { + tsconfig: 'tsconfig.test.json', + }, + ], + }, + transformIgnorePatterns: [ + 'node_modules/(?!(nanoid|next-auth|@auth)/)', + ], + setupFilesAfterEnv: ['/jest.setup.js'], + testTimeout: 10000, + verbose: true, + maxWorkers: '50%', + cacheDirectory: '/tmp/jest-cache', +};