test(runtime): add unit tests for terminal runtime helpers#96736
Conversation
Add unit tests for createNonExitingRuntime and writeRuntimeJson functions in src/runtime.ts to verify runtime behavior. Tests cover: - createNonExitingRuntime returns runtime with exit function - exit function throws error with code - writeRuntimeJson writes JSON using writeJson when available - writeRuntimeJson writes JSON using log when writeJson not available - uses custom space parameter - handles zero space parameter
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 6:19 AM ET / 10:19 UTC. Summary PR surface: Tests +76. Total +76 across 1 file. Reproducibility: not applicable. this is a test-coverage PR rather than a user-visible bug report. The PR body includes a live helper probe and targeted Vitest output for the behavior being covered. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the focused colocated tests after ordinary maintainer review and required checks complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a test-coverage PR rather than a user-visible bug report. The PR body includes a live helper probe and targeted Vitest output for the behavior being covered. Is this the best way to solve the issue? Yes: adding a colocated Vitest file is the narrowest maintainable way to cover these existing helpers, and current main does not already have direct duplicate coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ecb45bf7729. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +76. Total +76 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…96736) Add unit tests for createNonExitingRuntime and writeRuntimeJson functions in src/runtime.ts to verify runtime behavior. Tests cover: - createNonExitingRuntime returns runtime with exit function - exit function throws error with code - writeRuntimeJson writes JSON using writeJson when available - writeRuntimeJson writes JSON using log when writeJson not available - uses custom space parameter - handles zero space parameter
…96736) Add unit tests for createNonExitingRuntime and writeRuntimeJson functions in src/runtime.ts to verify runtime behavior. Tests cover: - createNonExitingRuntime returns runtime with exit function - exit function throws error with code - writeRuntimeJson writes JSON using writeJson when available - writeRuntimeJson writes JSON using log when writeJson not available - uses custom space parameter - handles zero space parameter
…96736) Add unit tests for createNonExitingRuntime and writeRuntimeJson functions in src/runtime.ts to verify runtime behavior. Tests cover: - createNonExitingRuntime returns runtime with exit function - exit function throws error with code - writeRuntimeJson writes JSON using writeJson when available - writeRuntimeJson writes JSON using log when writeJson not available - uses custom space parameter - handles zero space parameter
…96736) Add unit tests for createNonExitingRuntime and writeRuntimeJson functions in src/runtime.ts to verify runtime behavior. Tests cover: - createNonExitingRuntime returns runtime with exit function - exit function throws error with code - writeRuntimeJson writes JSON using writeJson when available - writeRuntimeJson writes JSON using log when writeJson not available - uses custom space parameter - handles zero space parameter
What Problem This Solves
The
runtime.tsmodule provides terminal runtime helpers for CLI command implementations. However, this module lacked unit tests to verify the runtime behavior, which could lead to regressions when the function is modified.Why This Change Was Made
Add unit tests for
createNonExitingRuntimeandwriteRuntimeJsonfunctions to verify runtime behavior. This improves test coverage and prevents regressions.Focused tests cover runtime creation, exit behavior, JSON writing, and error handling.
User Impact
Terminal runtime helpers now have comprehensive test coverage, reducing the risk of regressions when the function is modified.
Evidence
Reproducibility: not applicable. This PR adds direct coverage for existing helper behavior rather than reporting a user-visible runtime bug. Source inspection confirms the helper behavior the tests target.
Direct behavior probe:
Targeted test:
Formatting:
Whitespace:
AI-assisted
Prepared with Codex. I reviewed the change, understand the touched code path, and kept the PR focused on the bug described above.