feat: add Vitest testing setup with 57 passing tests#43
Merged
Conversation
- Extract 4 pure functions from index.html into public/utils.js (browser
globals + CJS exports for Node); functions still available globally in
the browser via <script src="/utils.js"> loaded before the main script
- Export 5 pure functions from src/index.ts for unit testing
- Add vitest + @vitest/coverage-v8 devDependencies
- Add test scripts: npm test, npm run test:coverage, npm run typecheck
- Add skipLibCheck + allowJs to tsconfig to support test files cleanly
- Add .github/workflows/ci.yml: typecheck + coverage on push/PR with
vitest-coverage-report-action posting coverage table as PR comment
- Fix .gitignore merge conflict; add node_modules/ and coverage/
Test coverage:
unit/ — chunkText, parseTimePhrase, rerankWithTimeDecay
ui/ — parseRecallResult, escHtml, escAttr, toDateStr
integration/ — auth (all routes), capture (dup detection), append,
list, tags, cors
https://claude.ai/code/session_01HCeXTDxnrpjTwmV2Qa6cgB
e6cb564 to
1e72a05
Compare
npm install was failing in CI due to peer dependency conflicts (@types/node vs existing deps). npm ci reads the committed lockfile directly, bypassing re-resolution. https://claude.ai/code/session_01HCeXTDxnrpjTwmV2Qa6cgB
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
globals + CJS exports for Node); functions still available globally in
the browser via <script src="/utils.js"> loaded before the main script
vitest-coverage-report-action posting coverage table as PR comment
Test coverage:
unit/ — chunkText, parseTimePhrase, rerankWithTimeDecay
ui/ — parseRecallResult, escHtml, escAttr, toDateStr
integration/ — auth (all routes), capture (dup detection), append,
list, tags, cors
https://claude.ai/code/session_01HCeXTDxnrpjTwmV2Qa6cgB