b207bfa7af
test: 添加单元测试和端到端测试 refactor: 重构登录页面和上传模块 ci: 更新测试覆盖率阈值至42% build: 添加测试相关依赖 docs: 更新测试文档 style: 修复代码格式问题
36 lines
906 B
JavaScript
36 lines
906 B
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__/**',
|
|
],
|
|
coverageThreshold: {
|
|
global: {
|
|
branches: 30,
|
|
functions: 40,
|
|
lines: 42,
|
|
statements: 42,
|
|
},
|
|
},
|
|
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%',
|
|
}; |