perf(test): separate integration boundaries

This commit is contained in:
saltbo
2026-08-05 13:10:28 -04:00
parent bfb9e08e6e
commit 9339aa385a
4 changed files with 33 additions and 9 deletions
+10 -5
View File
@@ -82,10 +82,14 @@ jobs:
projects: --project backend-unit
scope: backend
report: backend-unit
- label: Backend integration
projects: --project backend-integration
- label: Backend HTTP integration
projects: --project backend-integration-http
scope: backend
report: backend-integration
report: backend-integration-http
- label: Backend data integration
projects: --project backend-integration-data
scope: backend
report: backend-integration-data
- label: Frontend
projects: --project frontend-unit
scope: frontend
@@ -149,9 +153,10 @@ jobs:
- name: Verify every coverage report is present
run: |
test -f .vitest-reports/backend-unit.blob
test -f .vitest-reports/backend-integration.blob
test -f .vitest-reports/backend-integration-http.blob
test -f .vitest-reports/backend-integration-data.blob
test -f .vitest-reports/frontend.blob
test "$(find .vitest-reports -type f -name '*.blob' | wc -l)" -eq 3
test "$(find .vitest-reports -type f -name '*.blob' | wc -l)" -eq 4
- name: Merge coverage and enforce thresholds
env:
COVERAGE_ENFORCE: '1'
+1 -1
View File
@@ -35,7 +35,7 @@ pnpm e2e # Playwright E2E tests
- Backend unit tests use `*.test.ts`, run in Node, and must not create a database-backed application.
- Frontend unit and component tests use `*.test.ts(x)` and run in jsdom.
- Backend repository, HTTP, and application integration tests use `*.integration.test.ts`.
- Backend repository, HTTP, and application integration tests use `*.integration.test.ts`; CI runs HTTP/application and datastore/adapter boundaries independently.
- `*.cf-test.ts` is reserved for behavior that specifically needs D1, Workers bindings, or the Workers runtime.
- Pull requests run only `@critical` browser journeys against the local Cloudflare runtime. The complete multi-viewport browser suite runs nightly.
- Tests must replace S3 and ZPan Cloud with local fakes; CI must not depend on staging services or credentials.
+2 -2
View File
@@ -32,10 +32,10 @@
"oauth-scopes:backfill": "tsx scripts/backfill-oauth-scopes.ts",
"ids:normalize": "tsx scripts/normalize-ids.ts",
"typecheck": "node scripts/run-typecheck.mjs",
"test": "vitest run --project backend-unit --project frontend-unit --project backend-integration",
"test": "vitest run --project backend-unit --project frontend-unit --project backend-integration-http --project backend-integration-data",
"test:cf": "vitest run --project cloudflare-contract --project cloudflare-isolated",
"test:libsql": "vitest run --project libsql",
"test:watch": "vitest --project backend-unit --project frontend-unit --project backend-integration",
"test:watch": "vitest --project backend-unit --project frontend-unit --project backend-integration-http --project backend-integration-data",
"lint": "biome check . && pnpm lint:ids && pnpm lint:tests",
"lint:ids": "node scripts/lint-id-generation.mjs",
"lint:tests": "node scripts/lint-test-boundaries.mjs",
+20 -1
View File
@@ -79,6 +79,15 @@ const isolatedCloudflareTests = [
'workers/bootstrap.cf-test.ts',
]
const backendHttpIntegrationTests = [
'server/app.integration.test.ts',
'server/auth.integration.test.ts',
'server/cors.integration.test.ts',
'server/openapi.integration.test.ts',
'server/http/**/*.integration.test.ts',
'server/middleware/**/*.integration.test.ts',
]
export default defineConfig({
test: {
globals: true,
@@ -111,8 +120,18 @@ export default defineConfig({
{
resolve: { alias: aliases },
test: {
name: 'backend-integration',
name: 'backend-integration-http',
include: backendHttpIntegrationTests,
testTimeout: 15_000,
setupFiles: ['./server/test/app-version.ts'],
},
},
{
resolve: { alias: aliases },
test: {
name: 'backend-integration-data',
include: ['server/**/*.integration.test.ts'],
exclude: backendHttpIntegrationTests,
testTimeout: 15_000,
setupFiles: ['./server/test/app-version.ts'],
},