managarten/services/mana-core-auth/jest.config.js
Wuesteon 0ebfde0851 fix(ci): build shared packages before tests and fix formatting
- Add build:packages step to all test.yml jobs (fixes @manacore/shared-nestjs-auth not found)
- Handle missing coverage artifacts gracefully in test-coverage.yml
- Update .prettierignore to exclude apps-archived/ and problematic files
- Format all source files to pass CI checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 23:15:00 +01:00

61 lines
1.6 KiB
JavaScript

module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: 'src',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: [
'**/*.(t|j)s',
'!**/*.module.ts',
'!**/*.interface.ts',
'!**/main.ts',
'!**/*.dto.ts',
'!**/*.schema.ts',
'!**/index.ts',
'!**/migrate.ts',
'!**/connection.ts',
],
coverageDirectory: '../coverage',
testEnvironment: 'node',
// Handle ESM modules (nanoid, better-auth)
transformIgnorePatterns: ['node_modules/(?!(nanoid|better-auth)/)'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/$1',
'^nanoid$': '<rootDir>/../test/__mocks__/nanoid.ts',
'^better-auth$': '<rootDir>/../test/__mocks__/better-auth.ts',
'^better-auth/types$': '<rootDir>/../test/__mocks__/better-auth.ts',
'^better-auth/plugins$': '<rootDir>/../test/__mocks__/better-auth-plugins.ts',
'^better-auth/plugins/(.*)$': '<rootDir>/../test/__mocks__/better-auth-plugins.ts',
'^better-auth/adapters/(.*)$': '<rootDir>/../test/__mocks__/better-auth-adapters.ts',
},
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
// Critical paths require 100% coverage
'./auth/auth.service.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
'./credits/credits.service.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
'./common/guards/jwt-auth.guard.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
setupFilesAfterEnv: ['<rootDir>/../test/setup.ts'],
testTimeout: 10000,
};