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)
This commit is contained in:
2025-10-20 15:13:38 -04:00
parent e3ab2f18f5
commit fb959338c3
4 changed files with 73 additions and 1 deletions

View File

@@ -10,5 +10,13 @@ module.exports = {
],
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
}
}
};