From 9d08a413c3e7056411d081892686c04f39821680 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Tue, 1 Sep 2026 07:41:19 +0000 Subject: [PATCH] perf(tests): move the evidence-capture browser journey to a nightly pool (#128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runtime-playground-capture.test.ts produces a documentation artifact (screenshots + evidence.json) through a full HMR/last-good/recovery browser journey under the repo's largest budget (600s). Its behavioral contracts are already proven per PR by runtime-playground.e2e.test.ts and runtime-playground-hmr.e2e.test.ts in the same pool, so the capture harness now runs through the new `pnpm test:evidence` script (rstest.evidence.config.ts, one worker, same shared example-payload globalSetup) in CI's nightly packed-matrix job instead of every per-PR integration run — evidence regenerates when the flow changes, not on every PR. Verified: `pnpm test:evidence` green (all three tests including the full browser journey), typecheck and lint green, and the moved file stays excluded from the unit pool. --- .github/workflows/ci.yml | 4 ++++ package.json | 1 + rstest.evidence.config.ts | 23 +++++++++++++++++++++++ rstest.integration-tests.ts | 15 ++++++++++++++- rstest.unit.config.ts | 4 ++-- 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 rstest.evidence.config.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8efd2e11d..bda2f9dc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,10 @@ jobs: pnpm exec playwright install --with-deps chrome fi - run: pnpm check:release + # Nightly evidence-capture pool: documentation-artifact browser + # journeys whose behavioral contracts are already proven per PR by the + # integration pool (see nightlyEvidenceTestFiles). + - run: pnpm test:evidence rsc-runtime-micro-eval: # Deterministic end-to-end spot-check of the built RSC runtime artifacts diff --git a/package.json b/package.json index 73317258e..671d319b2 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test:unit": "rstest --config rstest.unit.config.ts", "test:integration": "pnpm build && pnpm test:integration:run", "test:integration:run": "AGENT_BUNDLE_WORKBENCH_PREBUILT=1 AGENT_BUNDLE_PACKAGE_PREBUILT=1 rstest --config rstest.integration.config.ts", + "test:evidence": "pnpm build && AGENT_BUNDLE_WORKBENCH_PREBUILT=1 AGENT_BUNDLE_PACKAGE_PREBUILT=1 rstest --config rstest.evidence.config.ts", "test:watch": "rstest --config rstest.config.ts --watch", "lint": "rslint .", "typecheck": "tsc --noEmit && tsc --project packages/workbench/tsconfig.json && tsc --project packages/create-agent-bundle/tsconfig.json", diff --git a/rstest.evidence.config.ts b/rstest.evidence.config.ts new file mode 100644 index 000000000..864d024cc --- /dev/null +++ b/rstest.evidence.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from '@rstest/core'; + +import { nightlyEvidenceTestFiles } from './rstest.integration-tests.ts'; +import { withAgentBundleRslibConfig } from './rstest.rslib.ts'; + +/** + * The nightly evidence-capture pool (`pnpm test:evidence`): the single-file + * documentation-artifact journeys listed in nightlyEvidenceTestFiles. One + * worker — each journey drives its own Chrome + dev-server + rsbuild trio + * end to end, so there is nothing to parallelize — and the same shared + * example-payload globalSetup the integration pool uses, because the + * capture harness copies `examples/rsc-agent-runtime/dist` through + * runtime-playground-fixture.ts. + */ +export default defineConfig({ + extends: withAgentBundleRslibConfig(), + include: [...nightlyEvidenceTestFiles], + globalSetup: ['./rstest.integration.setup.ts'], + pool: { maxWorkers: 1 }, + setupFiles: ['./rstest.setup.ts'], + isolate: true, + testTimeout: 30_000, +}); diff --git a/rstest.integration-tests.ts b/rstest.integration-tests.ts index 11e96cea6..ea4402a5a 100644 --- a/rstest.integration-tests.ts +++ b/rstest.integration-tests.ts @@ -59,12 +59,25 @@ export const integrationTestFiles: readonly string[] = [ 'packages/workbench/tests/rsbuild-workbench.test.ts', 'packages/workbench/tests/runtime-inspector.test.ts', 'packages/workbench/tests/runtime-consent-dialog.test.ts', - 'packages/workbench/tests/runtime-playground-capture.test.ts', 'packages/workbench/tests/runtime-playground.e2e.test.ts', 'packages/workbench/tests/runtime-playground-hmr.e2e.test.ts', 'packages/workbench/tests/workbench-dev-command.test.ts', ]; +/** + * Evidence-capture harnesses: browser journeys whose product is a + * documentation artifact (screenshots + evidence.json), not a per-PR + * behavioral proof. The behavioral contracts they exercise (HMR activation, + * last-good retention, recovery) are already covered per PR by + * runtime-playground.e2e.test.ts and runtime-playground-hmr.e2e.test.ts in + * the integration pool, so these run through the root `test:evidence` + * script in CI's nightly schedule instead — evidence regenerates when the + * flow changes, not on every PR (#128). + */ +export const nightlyEvidenceTestFiles: readonly string[] = [ + 'packages/workbench/tests/runtime-playground-capture.test.ts', +]; + /** * Pack-and-install tests: each one consumes the run-level release tarball * (and usually a clean `npm install` of it), which dominates the serialized diff --git a/rstest.unit.config.ts b/rstest.unit.config.ts index c5a4ad9d4..1970e4561 100644 --- a/rstest.unit.config.ts +++ b/rstest.unit.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from '@rstest/core'; -import { integrationTestFiles, packedTestFiles, templateTestFiles } from './rstest.integration-tests.ts'; +import { integrationTestFiles, nightlyEvidenceTestFiles, packedTestFiles, templateTestFiles } from './rstest.integration-tests.ts'; import { withAgentBundleRslibConfig } from './rstest.rslib.ts'; /** Build-free, process-free tests only; safe on parallel workers. `pnpm test` runs this before the integration config. */ @@ -9,7 +9,7 @@ export default defineConfig({ include: [ 'packages/**/tests/**/*.test.ts', ], - exclude: [...integrationTestFiles, ...packedTestFiles, ...templateTestFiles], + exclude: [...integrationTestFiles, ...nightlyEvidenceTestFiles, ...packedTestFiles, ...templateTestFiles], setupFiles: ['./rstest.setup.ts'], // Unit files construct per-test services; logs-real.e2e is not in this pool. isolate: false,