jest.config.js•1.09 kB
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src/', '<rootDir>/test/'],
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.ts',
'!src/index.ts',
'!src/**/*.d.ts',
'!src/types.ts'
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0
}
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
clearMocks: true,
resetMocks: true,
restoreMocks: true,
testTimeout: 10000,
// Skip TypeScript typechecking for test files
// This speeds up the tests and avoids issues with missing typings
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true, // This skips TypeScript type checking
diagnostics: false // Disable diagnostics
}
]
}
};