Skip to content

chore(test): make the test suite output quiet#515

Open
obra wants to merge 35 commits into
danshapiro:mainfrom
obra:chore/quiet-test-output
Open

chore(test): make the test suite output quiet#515
obra wants to merge 35 commits into
danshapiro:mainfrom
obra:chore/quiet-test-output

Conversation

@obra

@obra obra commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Makes the test suite output much less noisy. The coordinated suite now passes with pristine output:

  • Adds a shared console.error/warn trap (test/setup) that fails tests on unexpected console output, mirrored on both client and server configs — expected errors/warnings must now be explicitly captured and asserted.
  • Captures expected error/warn logs across ~30 test files (network-manager, port-forward, sdk-bridge, config-store, settings thunks, terminal lifecycle, storage migrations, etc.) instead of letting them spill into the runner output.
  • Silences perf-telemetry console.info in perf tests and the Node SQLite experimental warning.
  • Stops echoing the large-forward child's stdout on success in codex runtime tests.
  • Fixes a jsdom navigation leak (mailto click) and completes the @/lib/api mock in e2e tests.
  • fix(bootstrap): only auto-run env bootstrap when launched as the server entry, so importing server modules under test doesn't touch .env.

Testing

Full coordinated suite (npm test, default + server configs) is green with clean output.

obra added 30 commits July 18, 2026 02:33
…rror trap

Generalizes the existing console.error trap in the shared DOM setup to also
trap console.warn: a test that does not capture a warning it triggers now
fails, so unexpected console noise is treated as a bug. Tests opt out for a
single case via __ALLOW_CONSOLE_WARN__, mirroring __ALLOW_CONSOLE_ERROR__.
Redux Toolkit's dev-only invariant-middleware timing warning is machine-load
dependent perf noise, not app output, so it is filtered out to avoid flakes.
…lure warning

The mock omitted isTransientRequestFailure, which App.tsx calls on the bootstrap
retry path, so the classifier threw instead of running. Provide the real export
via importActual and capture the contained '[App] Failed to load bootstrap data'
warning the transient-recovery scenario legitimately emits.
Both the client (jsdom) and the new server (node) setups need the same
'unexpected console output fails the test' trap, so factor it out of dom.ts
into test/setup/console-trap.ts.
Under test runtime the shared pino logger writes its console-bound records to
an in-memory buffer (a dependency-light standalone module, so the server test
setup can read them without importing the logger's heavy graph and defeating
per-test module mocks). Adds an assert-and-consume helper for expected logs.
Fails a server test on unexpected console.error/warn or unexpected captured
pino error records, mirroring the client trap; opt out per test with
__ALLOW_CONSOLE_ERROR__/__ALLOW_CONSOLE_WARN__ or assert via
consumeCapturedLogRecords. Filters only Node's SQLite ExperimentalWarning.
…er entry

Importing the module for its exports (unit tests, network-manager pulling in
detectLanIps) previously mutated the real project .env and printed first-run
setup output. Gate the auto-run on process.argv being the server entry, which
still fires for the real and test-spawned server but not on library import.
The child's memory diagnostic is only useful on failure, which the catch
already surfaces in the thrown error; echoing it on success is just noise.
obra added 5 commits July 18, 2026 03:28
… warning

Wires test/setup/server.ts as a setupFile so unexpected server log output fails
the suite, and passes --disable-warning=ExperimentalWarning to worker threads so
node:sqlite's one-time load warning stops polluting test output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant