From 3f780bb27da18c464f1393f7e78b5b73216a3d7c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 28 Apr 2026 18:47:41 +0100 Subject: [PATCH] test: share Docker test-state wrapper --- docs/reference/test.md | 2 +- .../agents-delete-shared-workspace-docker.sh | 8 +----- ...bundled-plugin-install-uninstall-docker.sh | 9 ++++--- scripts/e2e/doctor-install-switch-docker.sh | 12 ++++----- .../e2e/npm-onboard-channel-agent-docker.sh | 8 +----- scripts/e2e/openai-image-auth-docker.sh | 5 ++-- scripts/lib/docker-e2e-image.sh | 16 ++++++++++++ scripts/lib/docker-e2e-scenarios.mjs | 7 +++++- test/scripts/docker-e2e-plan.test.ts | 25 ++++++++++++++++++- 9 files changed, 64 insertions(+), 28 deletions(-) diff --git a/docs/reference/test.md b/docs/reference/test.md index a66bb141c9b..07eb930204d 100644 --- a/docs/reference/test.md +++ b/docs/reference/test.md @@ -16,7 +16,7 @@ title: "Tests" - `pnpm check:changed`: runs the smart changed check gate for the diff against `origin/main`. It runs typecheck, lint, and guard commands for the affected architectural lanes, but does not run Vitest tests. Use `pnpm test:changed` or explicit `pnpm test ` for test proof. - `pnpm test`: routes explicit file/directory targets through scoped Vitest lanes. Untargeted runs use fixed shard groups and expand to leaf configs for local parallel execution; the extension group always expands to the per-extension shard configs instead of one giant root-project process. - Test wrapper runs end with a short `[test] passed|failed|skipped ... in ...` summary. Vitest's own duration line stays the per-shard detail. -- Shared OpenClaw test state: use `src/test-utils/openclaw-test-state.ts` from Vitest when a test needs an isolated `HOME`, `OPENCLAW_STATE_DIR`, `OPENCLAW_CONFIG_PATH`, config fixture, workspace, agent dir, or auth-profile store. Docker/Bash E2E lanes can use `scripts/lib/openclaw-test-state.mjs shell --label --scenario ` for an in-container shell snippet, or `node scripts/lib/openclaw-test-state.mjs -- create --label --scenario --env-file --json` for a sourceable host env file. The `--` before `create` keeps newer Node runtimes from treating `--env-file` as a Node flag. +- Shared OpenClaw test state: use `src/test-utils/openclaw-test-state.ts` from Vitest when a test needs an isolated `HOME`, `OPENCLAW_STATE_DIR`, `OPENCLAW_CONFIG_PATH`, config fixture, workspace, agent dir, or auth-profile store. Docker/Bash E2E lanes that source `scripts/lib/docker-e2e-image.sh` can pass `docker_e2e_test_state_shell_b64