Skip to content

feat: automated test suite and CI (closes #5) - #26

Merged
kasunben merged 4 commits into
mainfrom
feat/automated-test-suite
Jun 7, 2026
Merged

feat: automated test suite and CI (closes #5)#26
kasunben merged 4 commits into
mainfrom
feat/automated-test-suite

Conversation

@kasunben

@kasunben kasunben commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • 82 unit/integration tests (Vitest, pool: 'forks', in-memory SQLite via DATABASE_PATH=:memory:) covering all 11 REST endpoints, rowToThread/threadToRow helpers, thread lifecycle, ownership rules, admin delete, incremental ?since= pulls, and export/import merge semantics
  • 15 E2E tests (Playwright, headless Chromium) covering offline persist/reload, BroadcastChannel multi-tab sync, server-sync two-user collaboration, access control (Edit/Delete gating, resolved-card freeze), resolve/un-resolve, and reply persistence
  • CI workflow (.github/workflows/ci.yml) — two jobs: unit+integration with lcov coverage artifact → E2E with Playwright report on failure
  • One production changeserver/db.js reads DATABASE_PATH env var (backwards-compatible; defaults to the existing server/data/annotate.db path)
  • README updated: Testing section now documents npm test, npm run test:e2e, and npm run test:all; npm scripts table and project structure updated

Test plan

  • npm run test:coverage → 82 tests pass, 85.7% statement coverage
  • npm run test:e2e → 15 tests pass, 1 skipped (P2P — opt-in via RUN_P2P=1)
  • Two consecutive E2E runs both green (no flakiness after waitForResponse + networkidle fixes)
  • .github/workflows/ci.yml syntax verified

🤖 Generated with Claude Code

kasunben and others added 4 commits June 7, 2026 14:30
Adds 82 unit/integration tests (Vitest) and 15 E2E tests (Playwright)
covering server logic, all REST endpoints, multi-user sync, access
control, BroadcastChannel, resolve/un-resolve, and reply persistence.

Key changes:
- server/db.js: DATABASE_PATH env var for in-memory test isolation
- vitest.config.mjs: pool:forks gives each file a fresh SQLite connection
- playwright.config.mjs: networkidle wait + waitForResponse eliminates
  flaky timing races in server-sync tests
- tests/unit: db helpers, all 11 REST endpoints via supertest
- tests/integration: thread lifecycle, ownership, admin delete, ?since=
  incremental pull, export/import merge semantics
- tests/e2e: single-browser, BroadcastChannel, server-sync two-user,
  access control, P2P relay (opt-in via RUN_P2P=1)
- .github/workflows/ci.yml: unit+integration with coverage → E2E
- README.md: replace "no automated test suite" with accurate docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds automated testing section (commands, layer table, key
implementation notes), test scripts to the npm scripts table,
test/ and config files to the project structure tree, and
ci.yml to the workflows list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Vitest 4.x requires Node ^20 || ^22 || >=24 (odd versions excluded).
The project pins Node 23 in .nvmrc; downgrade to vitest@^3.2.4 which
supports Node >=18. Also regenerates package-lock.json which was out of
sync (missing @emnapi/core, @emnapi/runtime, libp2p, esbuild entries).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Node 23 reached EOL June 2025. The package-lock.json was generated on
Node 24 where libp2p resolves to 2.10.0; on Node 23 it resolves to
2.1.8, causing `npm ci` to fail with a lock-file mismatch. Updating
.nvmrc and engines to 24 aligns CI, local dev, and the lock file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kasunben
kasunben merged commit 1055af5 into main Jun 7, 2026
4 checks passed
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.

1 participant