Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

84 lines
1.7 KiB
JavaScript

/**
* Jest Configuration for Claude Code Templates Analytics
* Phase 4: Testing & Optimization
*/
module.exports = {
// Test environment
testEnvironment: 'node',
// Test file patterns
testMatch: [
'**/tests/**/*.test.js',
'**/tests/**/*.spec.js',
'**/__tests__/**/*.js'
],
// Coverage configuration
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
collectCoverageFrom: [
'src/analytics/**/*.js',
'src/analytics-web/**/*.js',
'!src/analytics.log',
'!src/analytics-web/index.html*',
'!**/node_modules/**',
'!**/coverage/**'
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70
},
'./src/analytics/core/': {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
// Module paths
roots: ['<rootDir>/src', '<rootDir>/tests'],
// Transform files
transform: {},
// Test timeout
testTimeout: 10000,
// Verbose output
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Restore mocks after each test
restoreMocks: true,
// Module name mapping for frontend tests
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/analytics-web/$1',
'^@analytics/(.*)$': '<rootDir>/src/analytics/$1'
},
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/coverage/',
'/dist/'
],
// Watch plugins
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
]
};