mirror of
https://github.com/scotttomaszewski/obsidian-disciples-journal.git
synced 2026-07-22 12:20:30 +00:00
1.5 KiB
1.5 KiB
Testing
Running the tests
npm test # or: devbox run test
Tests also run automatically as part of npm run build and just release (see
below) — a failing test blocks both.
Layout & runner
- Tests live in
test/, one*.test.tsfile per unit under test (e.g.test/BibleReference.test.ts). - The runner is Node's built-in test runner (
node:test+node:assert/strict), withtsxtranspiling TypeScript on the fly — no separate config file. - The npm script is
tsx --test test/*.test.ts. The single-*glob is expanded by the shell (so it works on Node 20 and 22 alike); keep test files flat intest/rather than nested. @types/nodeis pinned to a v22 line sonode:testtypings are available totscand eslint (which type-check**/*.ts, including the tests).
What's covered
BibleReference—parse(the full format matrix from reference-formats.md, book-name variants, normalization, null cases),toStringround-trips, and the value-object helpers.
This is the first suite; extend it as other pure logic becomes test-worthy.
Gating
npm run buildrunstsc→npm test→ esbuild, so tests must pass before a bundle is produced (and before you commit, per ../CLAUDE.md).just releaserunsnpm testbefore bumping versions, so a failing test aborts the release before anything is mutated. See build-and-release.md.