English | 中文
This document summarizes the basic verification steps and local E2E scripts available in the repo.
After day-to-day changes, run at least:
bun run build
cd frontend && bun run lintNotes:
bun run build: checks Worker, frontend application, and Vite-config types before building frontend assets intopublic/bun run typecheck: runs the same type checks without generating frontend assetscd frontend && bun run lint: runs frontend ESLint
Run focused regression tests with bun test tests. Database regression tests use isolated in-memory SQLite and local D1 bindings (getPlatformProxy with persistence and remote bindings disabled). They do not modify existing local or production D1 data. tests/local-d1.test.ts checks migration and concurrent authentication against the actual local D1 runtime.
The repo ships a mock-upstream based local end-to-end suite:
tests/mock-upstream.ts: local mock upstreamtests/setup-test-data.sh: writes test channels and tokens into local D1tests/run-e2e.sh: verifies proxy paths, model list, auth failures, header scrubbing, and more
Current E2E mainly covers:
/v1/models/v1/chat/completions/v1/messages/v1/responses- Upstream header allowlist and sensitive-header stripping
- Admin login rate limits and system-settings scenarios
Before running:
- Local Worker is running on the default port
:8787(bun run dev:worker) - Local mock upstream is listening on
:9999(bun run tests/mock-upstream.ts) - Required env vars are set in
.dev.varsor the current shell (notablyADMIN_TOKENfor admin login and rate limit tests) - Local D1 is reachable via
wrangler.local.jsonc
- Start mock upstream
bun run tests/mock-upstream.ts- Start the local Worker
bun run dev:worker- Seed test data
bash tests/setup-test-data.sh- Run E2E
bash tests/run-e2e.sh- Scripts assume local ports (Worker
:8787, mock upstream:9999) andwrangler.local.jsonc tests/setup-test-data.shwrites and cleans local test data — do not run it against productiontests/run-e2e.shuses GNUdate -d; macOS users encounteringdate: illegal option -- dcan installcoreutils(brew install coreutilsand aliasgdate) or run inside a Linux environment- Doc-only or pure static frontend changes usually do not need a full E2E run