From 5a0702ecf828e82be5d9f608fd9ad4d2217083fa Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 29 Apr 2026 00:50:51 +0100 Subject: [PATCH] test: add reusable OpenClaw test instance helper --- docs/reference/test.md | 2 +- test/helpers/gateway-e2e-harness.ts | 283 +------------ test/helpers/openclaw-test-instance.test.ts | 58 +++ test/helpers/openclaw-test-instance.ts | 444 ++++++++++++++++++++ 4 files changed, 510 insertions(+), 277 deletions(-) create mode 100644 test/helpers/openclaw-test-instance.test.ts create mode 100644 test/helpers/openclaw-test-instance.ts diff --git a/docs/reference/test.md b/docs/reference/test.md index 07eb930204d..38bfe7a19a8 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 that source `scripts/lib/docker-e2e-image.sh` can pass `docker_e2e_test_state_shell_b64