feat: automated test suite and CI (closes #5) - #26
Merged
Conversation
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>
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.
Summary
pool: 'forks', in-memory SQLite viaDATABASE_PATH=:memory:) covering all 11 REST endpoints,rowToThread/threadToRowhelpers, thread lifecycle, ownership rules, admin delete, incremental?since=pulls, and export/import merge semantics.github/workflows/ci.yml) — two jobs: unit+integration with lcov coverage artifact → E2E with Playwright report on failureserver/db.jsreadsDATABASE_PATHenv var (backwards-compatible; defaults to the existingserver/data/annotate.dbpath)npm test,npm run test:e2e, andnpm run test:all; npm scripts table and project structure updatedTest plan
npm run test:coverage→ 82 tests pass, 85.7% statement coveragenpm run test:e2e→ 15 tests pass, 1 skipped (P2P — opt-in viaRUN_P2P=1)waitForResponse+networkidlefixes).github/workflows/ci.ymlsyntax verified🤖 Generated with Claude Code