Skip to content

feat: add Vitest testing setup with 57 passing tests#43

Merged
rahilp merged 3 commits into
mainfrom
claude/add-testing-setup-f8kgU
May 20, 2026
Merged

feat: add Vitest testing setup with 57 passing tests#43
rahilp merged 3 commits into
mainfrom
claude/add-testing-setup-f8kgU

Conversation

@rahilp
Copy link
Copy Markdown
Owner

@rahilp rahilp commented May 20, 2026

  • 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

- 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
@rahilp rahilp force-pushed the claude/add-testing-setup-f8kgU branch from e6cb564 to 1e72a05 Compare May 20, 2026 22:31
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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 52.23% 281 / 538
🔵 Statements 52.23% 281 / 538
🔵 Functions 78.94% 15 / 19
🔵 Branches 86.06% 105 / 122
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/index.ts 52.23% 86.06% 78.94% 52.23%
Generated in workflow #5 for commit 6afa6a1 by the Vitest Coverage Report Action

@rahilp rahilp merged commit bef77e8 into main May 20, 2026
1 check passed
@rahilp rahilp deleted the claude/add-testing-setup-f8kgU branch May 20, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants