refactor(test): standardize log capture on useCaptureLog#287
Draft
wyattjoh wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
Stack: wyattjoh/nextjs-pinned-range Part of a stacked PR chain. Do not merge manually. |
5 tasks
|
…e integration harness Replace ad-hoc log spy patterns across every command and lib test with the useCaptureLog helper. Refactor log.ts and spinner.ts so the helper can hook in cleanly, drop unused test-helper imports as a side effect. Add a harness test covering the lazy config-module loader so each test gets a fresh instance.
88c14ab to
8cc424a
Compare
2ca4be0 to
5e0198f
Compare
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
Standardize unit-test log capture on a single helper, and stabilize the integration harness.
Unit-test log capture is rebuilt on top of a
useCaptureLog()lifecycle helper that installs a fresh buffer per test viabeforeEach/afterEach, replacing the prior AsyncLocalStorage-backedcaptureLog().run(...)wrapper. With the slot installed automatically, test bodies no longer wrap their emitting calls. As part of this,log.ui()stops appending its own trailing newline so spinner cursor-control writes survive, thecli-programwriteErr newline-stripping workaround that compensated for the old behavior is removed, and a latent double-newline bug in the spinner output is fixed by moving the trailing\nonto each emitting call site.The integration harness's config load moves out of a top-level await so each test gets a fresh instance, and a new harness test covers the new shape.
Test plan
bun run format:checkbun run lintbun run typecheckbun run test