Files
obsidian-mcp-server/jest.config.js
Bill fb959338c3 test: add coverage regression protection
- Add Istanbul ignore comments for intentionally untested code
  - frontmatter-utils.ts: Buffer.from fallback (unreachable in Jest/Node)
  - note-tools.ts: Default parameter and response building branches
- Add tests for error message formatting (error-messages.test.ts)
- Add coverage thresholds to jest.config.js to detect regressions
  - Lines: 100% (all testable code must be covered)
  - Statements: 99.7%
  - Branches: 94%
  - Functions: 99%

Result: 100% line coverage on all modules with regression protection.
Test count: 512 → 518 tests (+6 error message tests)
2025-10-25 22:14:29 -04:00

23 lines
691 B
JavaScript

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/tests'],
testMatch: ['**/*.test.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
],
moduleNameMapper: {
'^obsidian$': '<rootDir>/tests/__mocks__/obsidian.ts'
},
coverageThreshold: {
global: {
lines: 100, // All testable lines must be covered (with istanbul ignore for intentional exclusions)
statements: 99.7, // Allow minor statement coverage gaps
branches: 94, // Branch coverage baseline
functions: 99 // Function coverage baseline
}
}
};