45 lines
No EOL
1.1 KiB
JavaScript
45 lines
No EOL
1.1 KiB
JavaScript
/** @type {import('jest').Config} */
|
|
module.exports = {
|
|
preset: 'ts-jest/presets/default-esm',
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
testEnvironment: 'node',
|
|
transform: {
|
|
'^.+\\.tsx?$': ['ts-jest', {
|
|
useESM: true,
|
|
}],
|
|
'^.+\\.jsx?$': ['ts-jest', {
|
|
useESM: true,
|
|
}],
|
|
},
|
|
testMatch: [
|
|
'**/.tests/**/*.test.js'
|
|
],
|
|
collectCoverage: true,
|
|
collectCoverageFrom: [
|
|
'dist/**/*.js', // Include all JS files in dist directory
|
|
'!dist/**/*.test.js', // Exclude test files
|
|
'!dist/**/*.spec.js', // Exclude spec files
|
|
'!dist/**/node_modules/**' // Exclude node_modules
|
|
],
|
|
coverageDirectory: 'coverage',
|
|
coverageReporters: ['text', 'lcov', 'html'],
|
|
|
|
// Practical 75% global coverage threshold
|
|
coverageThreshold: {
|
|
global: {
|
|
statements: 75,
|
|
branches: 75,
|
|
functions: 75,
|
|
lines: 75
|
|
}
|
|
},
|
|
|
|
setupFilesAfterEnv: ['./.tests/setup.js'],
|
|
globalTeardown: './.tests/teardown.js',
|
|
testTimeout: 10000,
|
|
verbose: true,
|
|
|
|
// Additional configuration to handle async operations
|
|
forceExit: true,
|
|
detectOpenHandles: false
|
|
};
|