refactor(test): standardize log capture on useCaptureLog#287
Conversation
|
Stack: wyattjoh/nextjs-pinned-range Part of a stacked-prs chain. Do not merge manually. |
|
88c14ab to
8cc424a
Compare
5e0198f to
7750d4a
Compare
950205c to
6f9372a
Compare
710f7b0 to
8881d1d
Compare
4183e10 to
b1d6e71
Compare
…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.
b1d6e71 to
05e1716
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (41)
📝 WalkthroughWalkthroughThis PR replaces the CLI's AsyncLocalStorage-based log capture mechanism with a module-level Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
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