mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
* test: stabilize four flaky tests at root cause - test/non-isolated-runner.ts: move shared-worker cleanup from onAfterRunSuite to onAfterRunFiles. Vitest early-returns runSuite for files that fail during collection, skipping onAfterRunSuite, so a crashed sibling left its evaluated real modules cached and the next file's vi.mock factories silently never applied — the "res.setHeader is not a function" failures in http-utils.authorize-request.test.ts. onAfterRunFiles fires per file regardless of collect/run outcome. Regression meta-test spawns a child vitest run (collect-crash sibling + mock-dependent file) and fails on the old runner with flavor:real vs flavor:mocked. - src/gateway/http-utils.authorize-request.test.ts: export every http-common binding http-auth-utils imports so the factory stays isolate:false-safe. - src/gateway/session-message-events.test.ts: drop the beforeAll 60s override; the suite harness cold-imports the full gateway server graph, which can legitimately exceed 60s under contention. Sibling suites use the shared project hookTimeout (120s/180s) for the same boot. - src/gateway/server-methods/agent.sessions-and-models.test-utils.ts: the finalize-throw test polled a 2s waitForAssertion for an off-turn background run; signal finalize via a promise resolved from the spy (event-driven, bounded by the test timeout) and keep the bounded poll for the follow-up respond/warn observations. - ui/src/pages/chat/chat-responsive.browser.test.ts: budget cold-app first renders at 30s (real-app cases boot a cold Vite dev server whose first transform can starve past 10s under 6-worker contention) and replace one-shot isVisible reads with bounded locator waits for the state-driven hover reveal. Proof: focused runs green; 5x repeats of the three gateway files and 5x repeats of chat-responsive with OPENCLAW_VITEST_MAX_WORKERS=6 all green; runner regression test fails pre-fix, passes post-fix. * test: isolate runner meta-test child env from GitHub Actions The child vitest inherited GITHUB_ACTIONS/CI from the runner job, which turned on ANSI colors (breaking the plain-substring assertions) and let the child's github-actions reporter emit ::error annotations the parent job rendered as its own failures. Drop GITHUB_ACTIONS/FORCE_COLOR and set NO_COLOR, which overrides every tinyrainbow enable path. * test: wait for parseable pid in tsdown-build pid-file polls waitForFile existence polling can catch writeFileSync's open-truncate 0-byte window, yielding NaN pids and false isProcessAlive failures (the same class as #109140). Poll until the file parses to a positive pid; covers all three sibling pid-read sites in the suite.