Skip to content

Commit 0f15b8e

Browse files
fullstackjamclaude
andcommitted
test: complete vitest-pool-workers migration, delete SQL-parser mock
Migrates the remaining 9 server tests to vitest-pool-workers and removes the fragile SQL-parsing mock DB. Pure-library tests (rate-limit, install-script, validation) and archtests stay on happy-dom — they don't need D1 or the Workers runtime. Migrated to pool-workers in this commit: - src/lib/server/auth.test.ts (JWT + DB-backed getCurrentUser) - src/routes/api/auth/cli/start/server.test.ts - src/routes/api/auth/cli/approve/server.test.ts - src/routes/api/configs/[slug]/server.test.ts - src/routes/api/configs/[slug]/revisions/server.test.ts - src/routes/[username]/[slug]/install/server.test.ts - src/routes/[username]/[slug]/config/server.test.ts - src/smoke-tests/{cli-auth-flow,config-crud,critical-paths}.test.ts The CLI auth-flow smoke test now exercises the real approve endpoint end-to-end (previously had to fake it because the mock couldn't handle datetime expressions). The config-crud smoke test now verifies UPDATE side effects in the DB (previously couldn't — mock didn't honor COALESCE). Infrastructure: - Adds src/lib/test/call.ts helper to cut RequestEvent boilerplate - Extends call() with params/clientAddress for routes that need them - Deletes src/lib/test/db-mock.ts (~390 lines of SQL-parsing mock) - Deletes src/lib/test/setup.ts (process.env shims no longer needed) - Deletes src/lib/test/helpers.ts (unused after migration) - Trims src/lib/test/fixtures.ts to data-only exports - Adds @cloudflare/vitest-pool-workers/types to tsconfig.json - Wires npm test / test:run / test:coverage to run both configs; adds test:happy-dom and test:workers for targeted runs Final test layout: 181 tests on pool-workers (14 files, real D1 + Workers runtime), 99 tests on happy-dom (6 files, pure libs + archtests). Both green; full npm run validate clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fa06e9b commit 0f15b8e

21 files changed

Lines changed: 1554 additions & 3666 deletions

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"prepare": "svelte-kit sync || echo ''",
1111
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1212
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13-
"test": "vitest",
13+
"test": "vitest run && vitest run --config vitest.workers.config.ts",
1414
"test:ui": "vitest --ui",
15-
"test:run": "vitest run",
16-
"test:coverage": "vitest run --coverage",
15+
"test:run": "vitest run && vitest run --config vitest.workers.config.ts",
16+
"test:happy-dom": "vitest run",
17+
"test:workers": "vitest run --config vitest.workers.config.ts",
18+
"test:coverage": "vitest run --coverage && vitest run --config vitest.workers.config.ts --coverage",
1719
"lint": "eslint .",
1820
"lint:fix": "eslint . --fix",
1921
"format": "prettier --write .",

0 commit comments

Comments
 (0)