Frontend Tests Added: - Jest configuration with TypeScript support - Jest setup with Next.js mocks - Unit tests for lib/metrics.ts (normalizePath, registry) - Unit tests for lib/api-metrics.ts (withMetrics wrapper) - Unit tests for middleware (auth routes, token detection) - Unit tests for API track route (payload validation) Dependencies added: - jest, @testing-library/react, @testing-library/jest-dom - ts-jest, jest-environment-jsdom, @types/jest 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
794 B
JavaScript
34 lines
794 B
JavaScript
/** @type {import('jest').Config} */
|
|
const config = {
|
|
testEnvironment: 'jsdom',
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
moduleNameMapper: {
|
|
'^@/(.*)$': '<rootDir>/$1',
|
|
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
},
|
|
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
|
|
transform: {
|
|
'^.+\\.(ts|tsx)$': ['ts-jest', {
|
|
tsconfig: 'tsconfig.json',
|
|
}],
|
|
},
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
collectCoverageFrom: [
|
|
'lib/**/*.{ts,tsx}',
|
|
'components/**/*.{ts,tsx}',
|
|
'app/**/*.{ts,tsx}',
|
|
'!**/*.d.ts',
|
|
'!**/node_modules/**',
|
|
],
|
|
coverageThreshold: {
|
|
global: {
|
|
branches: 50,
|
|
functions: 50,
|
|
lines: 50,
|
|
statements: 50,
|
|
},
|
|
},
|
|
};
|
|
|
|
module.exports = config;
|