ci: optimize test execution with parallelization

This commit is contained in:
张翔
2026-03-10 11:52:53 +08:00
parent 7e885c88a7
commit 7d67c8eef3
2 changed files with 57 additions and 12 deletions
+31 -12
View File
@@ -1,17 +1,36 @@
module.exports = {
testEnvironment: 'node',
collectCoverage: true,
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: 70,
functions: 70,
lines: 70,
statements: 70
}
branches: 20,
functions: 25,
lines: 25,
statements: 25,
},
},
coverageReporters: ['text', 'lcov', 'html', 'json'],
coverageDirectory: 'coverage',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testMatch: ['**/__tests__/**/*.test.ts', '**/*.test.ts'],
moduleFileExtensions: ['ts', 'js', 'json'],
transform: {
'^.+\\.ts$': 'ts-jest'
}
};
'^.+\\.(ts|tsx)$': 'ts-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(nanoid|next-auth|@auth)/)',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testTimeout: 10000,
verbose: true,
maxWorkers: '50%',
};