openclaw/test/helpers
Peter Steinberger 931c7b40b2
fix(test): first test or hook times out while compiled worker subprocesses prepare (#162792)
* fix(test): load compiled-subprocess declarations at collection

The first load of a compiled-subprocess declaration in a Vitest invocation
prepares the whole compiled worker generation (tens of seconds warm, minutes
cold). 387 test files first reached a declaration through an await import()
inside a test body or hook, so their first test or hook absorbed that
preparation and could time out.

Move those loads to collection at their owner: static subject imports,
static imports in the shared helpers that owned the lazy load, and a named
side-effect preload (src/test-utils/prepare-compiled-subprocesses.ts) for
suites that re-import their subject per test or whose first load happens in
production code they call. plugin-test-runtime keeps the host-capability
fixture lazy so its other consumers do not start loading that graph.
Document the rule in docs/help/testing/writing-tests.md.

335 of the 387 files now load their first declaration before collection
ends; 52 remain (48 extension tests needing an SDK preload, one package
test, three files over the line cap).

* fix(test): retain npm install fixture reuse

Preserve the existing failedSpawn reuse after merging main so the collection-time preload stays within the line-cap ratchet. Assertions and import ordering are unchanged.

* fix(test): keep memory-core facade cold-import assertion meaningful

The static subject import ran before beforeEach reset the loader mock, so the cold-import assertion passed vacuously. Restore the in-test subject imports after mock setup and preload the compiled-subprocess declaration during collection instead.
2026-10-01 11:42:59 -07:00
..
agents fix: prompt snapshots fail with configured media credentials (#162263) 2026-10-01 03:33:59 +00:00
auto-reply refactor(auto-reply): deslop auto-reply fourth pass (#159527) 2026-09-28 20:58:53 -07:00
config
cron refactor(cron): offload scheduler state writes (#161703) 2026-09-30 13:09:40 +00:00
gateway fix(config): settle writes after invalid canonical rereads (#161868) 2026-09-30 05:52:03 -07:00
infra
media-generation
AGENTS.md
apfs.ts
auth-wizard.test.ts
auth-wizard.ts
bounded-child-output.test.ts test(core,plugins): remove low-value tests (batch d029) (#158964) 2026-09-26 15:31:59 +00:00
bounded-child-output.ts
browser-bundled-plugin-fixture.ts
canonical-descendant-state.ts fix: prevent temporary-file exhaustion from SQLite coordination (#157413) 2026-09-27 05:30:41 -07:00
captured-io.ts
channel-admission-evidence.ts fix: recognize verified team admins as channel owners (#153508) 2026-09-21 19:56:45 -07:00
claude-cli-native-spawn-proof.ts fix(agents): npm-installed Claude CLI fails to launch on Windows (#138504) 2026-09-19 16:13:54 +05:30
command-fixture.ts fix: keep PR landing working across GitHub API quotas (#154376) 2026-09-21 06:40:29 +00:00
config-mutation-lock.ts
desktop-resize-real-fixture.test.ts fix(test): restore the real Gateway desktop proof 2026-09-21 21:24:49 -07:00
export-html-template.ts
fixture-diagnostics.ts fix: PR landing fails on exhausted GitHub quota (#154558) 2026-09-21 08:19:59 +00:00
fixture-lifetime.ts fix: isolate triage fixture acquisition and cleanup (#155736) 2026-09-22 06:54:21 -07:00
fixture-receipts.ts fix(test): Docker-all, nested-retention, and Vitest setup tooling tests time out on loaded hosts while polling ready files (#162627) 2026-10-01 05:19:32 -07:00
fs-large-directory-id.ts refactor: adopt fs-safe 0.16 and remove duplicate filesystem logic (#152972) 2026-09-19 13:50:32 -07:00
fs-safe-root.test-support.ts fix: preserve file operations with fs-safe 0.13.1 (#150263) 2026-09-16 17:21:11 -07:00
full-release-candidate.ts
gateway-client.test.ts chore(deps): refresh dependencies with a seven-day cutoff (#156363) 2026-09-23 17:35:48 +00:00
gateway-client.ts fix: prevent pre-hello inventory in node reconnect QA (#160925) 2026-09-29 00:44:20 -05:00
gateway-codex-harness-native-subagent.ts refactor: remove Tasks and TaskFlow runtime (#159179) 2026-09-27 10:40:29 -07:00
gateway-codex-harness.ts refactor: remove Tasks and TaskFlow runtime (#159179) 2026-09-27 10:40:29 -07:00
gateway-e2e-harness.test.ts test(core,plugins): remove low-value tests (batch d029) (#158964) 2026-09-26 15:31:59 +00:00
gateway-e2e-harness.ts
gateway-multi-acquisition.test.ts fix(test): first test or hook times out while compiled worker subprocesses prepare (#162792) 2026-10-01 11:42:59 -07:00
gateway-status-acquisition.test.ts fix(state): preserve admission when a retired inode is reused (#154176) 2026-09-20 17:31:06 -07:00
gateway-websocket.ts
image-fixtures.ts
live-image-probe.test.ts test(core,plugins): remove low-value tests (batch d029) (#158964) 2026-09-26 15:31:59 +00:00
live-image-probe.ts
loopback-dns.ts
mac-native.ts test(macos): keep fat64 fixture with signing tests (#131682) 2026-09-26 15:17:43 -07:00
mac-signing.ts feat(macos): run the private app runtime on the OpenClaw Bun fork (#161603) 2026-09-30 01:27:03 -07:00
managed-handoff-isolation.test.ts test: select Node for maintainer tooling fixtures (#162550) 2026-10-01 02:20:15 -07:00
managed-handoff-isolation.ts chore: stop Bun tests depending on enumeration order and global timer counts (#162450) 2026-10-01 00:38:38 -07:00
mock-logger.ts
node-toolchain.ts test(helpers): resolve npm beside Node so pnpm test does not run the npm shim (#161087) 2026-09-30 09:04:41 +00:00
node-version-cases.ts
normalize-text.ts
openai-long-context-live.test.ts test(core,plugins): remove low-value tests (batch d029) (#158964) 2026-09-26 15:31:59 +00:00
openai-long-context-live.ts
openai-responses-events.ts test(core,ai,ui): remove low-value tests (batch d124) (#162423) 2026-10-01 00:06:38 -07:00
openai-responses-sse.ts
openclaw-test-instance.acquisition.test.ts fix(test): keep absent Gateway status fixtures unreachable (#161032) 2026-09-29 00:58:46 -07:00
openclaw-test-instance.port-collision.test.ts fix(test): prevent port probes from colliding with fixture reservations (#155228) 2026-09-21 22:24:27 +00:00
openclaw-test-instance.runtime.test.ts fix(test): preserve selected CLI and Gateway runtime (#154809) 2026-09-21 06:01:47 -07:00
openclaw-test-instance.test.ts fix(update): package activation recovery rejects Bun-hosted installs (#162586) 2026-10-01 09:54:24 -07:00
openclaw-test-instance.ts fix(qa): align fixtures with current gateway contracts (#161541) 2026-09-29 23:21:33 -05:00
openclaw-test-instance.unjoined.test.ts fix: Windows cleanup leaves descendants running after leader exit (#150244) 2026-09-17 07:40:19 -07:00
openclaw-test-instance.windows-job.test.ts fix: Windows cleanup leaves descendants running after leader exit (#150244) 2026-09-17 07:40:19 -07:00
paths.ts
pattern-file.ts
private-update-handoff-store.ts chore: stop Bun tests depending on enumeration order and global timer counts (#162450) 2026-10-01 00:38:38 -07:00
process-wait.test.ts fix(test): CI fails healthy tests when a loaded runner outlasts short wall-clock deadlines (#161691) 2026-09-30 09:29:34 +00:00
process-wait.ts perf(test): reuse tooling fixtures and control readiness clocks (#153685) 2026-09-20 06:46:45 -07:00
process-watchdog.ts
promise.ts fix(test): CI fails healthy tests when a loaded runner outlasts short wall-clock deadlines (#161691) 2026-09-30 09:29:34 +00:00
provider-http.test.ts
provider-http.ts
publishable-plugin-fixture.ts fix(cli): release plugin resources when help finishes (#160181) 2026-09-30 15:28:57 -07:00
qa-gateway-cleanup-lifecycle.test.ts
qa-gateway-cleanup.test.ts fix(test): first test or hook times out while compiled worker subprocesses prepare (#162792) 2026-10-01 11:42:59 -07:00
qa-gateway-cleanup.ts
qa-gateway-test-lifetime.test.ts
qa-gateway-test-lifetime.ts
qa-plugin-entry-observation.ts test(qa): restore Crabline callback and runtime identity proofs (#162819) 2026-10-01 23:37:33 +07:00
qa-prepared-repo-cli.ts
qa-subagent-runs.ts refactor: remove Tasks and TaskFlow runtime (#159179) 2026-09-27 10:40:29 -07:00
record.test.ts
record.ts
refs.ts
release-workflow-timeouts.ts
run-node-script.test.ts fix(test): shared test-instance and node-script helper tests time out on loaded hosts while polling readiness (#162608) 2026-10-01 03:23:26 -07:00
run-node-script.ts
runtime-preload.ts chore: stop Bun tests depending on enumeration order and global timer counts (#162450) 2026-10-01 00:38:38 -07:00
scheduled-message-read-model.ts fix: restore scheduled reads for creator accounts (#150278) 2026-09-17 06:21:06 +01:00
session-manager-file-fixture.ts
source-import-closure.ts refactor: run plugins and tooling without TypeScript 6 (#156829) 2026-09-23 22:34:20 -07:00
sqlite-parent-observer.ts refactor: move reply recovery reads off the Gateway thread (#155982) 2026-09-25 00:57:14 -07:00
sqlite-sessions-transcripts-flip-proof-assertions.test.ts fix(qa): align fixtures with current gateway contracts (#161541) 2026-09-29 23:21:33 -05:00
sqlite-sessions-transcripts-flip-proof-assertions.ts fix(qa): align fixtures with current gateway contracts (#161541) 2026-09-29 23:21:33 -05:00
sqlite-sessions-transcripts-flip-proof.ts fix(test): classify drained legacy migration refusals 2026-09-23 00:04:21 -07:00
sqlite-statement-execution-counter.ts perf(sessions): keep cold snapshots out of metadata reads (#160358) 2026-09-29 02:39:21 +00:00
stage-live-auth-profiles.test.ts refactor(auth): prepare bounded shared auth scopes asynchronously (#152286) 2026-09-19 21:54:00 -07:00
stage-live-auth-profiles.ts refactor(auth): prepare bounded shared auth scopes asynchronously (#152286) 2026-09-19 21:54:00 -07:00
stop-child-process.ts test(cli): diagnose stalled Doctor test children (#151161) 2026-09-17 18:50:58 -07:00
stt-live-audio.test.ts
temp-dir.test.ts test(core,plugins): remove low-value tests (batch d029) (#158964) 2026-09-26 15:31:59 +00:00
temp-dir.ts
temp-repo.ts
text-tool-result.ts
theme-fixture.ts feat: let agents apply plugin and personal themes (#152460) 2026-09-19 04:51:01 -07:00
tls-fixture.ts
typescript.ts refactor: run plugins and tooling without TypeScript 6 (#156829) 2026-09-23 22:34:20 -07:00
ui-style-fixtures.ts
upgrade-survivor-diagnostics.ts refactor: remove Tasks and TaskFlow runtime (#159179) 2026-09-27 10:40:29 -07:00
user-message.ts
vitest-config-paths.ts
vitest-shutdown-command.ts
wizard-prompter.ts
worker-activity.ts
worker-provider-replay-roundtrip.ts perf(gateway): offload placement turn claims from the main thread (#158486) 2026-09-26 02:26:02 +00:00
workflow-bash.ts fix(tests): use Bash 5 for Linux workflow fixtures (#149152) 2026-09-15 09:53:11 -07:00