chore(test): make the test suite output quiet#515
Open
obra wants to merge 35 commits into
Open
Conversation
…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.
…g rebind in network-manager tests
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the test suite output much less noisy. The coordinated suite now passes with pristine output:
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.@/lib/apimock 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.