Repository navigation
fix(test): stop use-input test from leaking a global stdin mock - #1501
Conversation
The use-input.test.ts added in Twigpine#1198 broke the full `bun test` run two ways: 1. It imported `@testing-library/react-hooks`, which was never installed and is React 16/17/18-only (incompatible with this repo's React 19), so the file errored on load. 2. Its top-level `vi.mock('./use-stdin.js', …)` registered a module mock that leaks across every later file in the same `bun test` process. The fake eventEmitter's `.on` was a no-op, so `useInput` silently registered no listener and dropped all keystrokes — surfacing as timeouts in MonitorPermissionRequest and the agent-menu/wizard TextInput tests (which passed in isolation but failed in the full suite). Rewrite the test to inject the stdin handle via StdinContext.Provider (no leaking global mock) and render through the real ink root (no @testing-library/react-hooks). Drop the now-dead react-hooks and react-test-renderer devDependencies and reconcile the lockfile. Full suite: 3429 pass, 0 fail (was 9 fail + 1 error). Co-Authored-By: OpenClaude <openclaude@gitlawb.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR removes the ChangesTest Harness Migration
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 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. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Upstream 343cd1a..1204fe2, applied 6 of 8 KEEP candidates in tier 1: 11e46af fix(typecheck): narrow hook event counts (Twigpine#1496) 2c755d3 fix(typecheck): restore typed add-dir source (Twigpine#1504) 2bed184 perf(attachments): skip skill listings for utility forks (Twigpine#1545) 47eea3f fix(typecheck): type search UI state (Twigpine#1529) 96ddec7 fix(test): stop use-input test from leaking a global stdin mock (Twigpine#1501) 1fc5116 fix(api): tighten reasoning_content heuristic to prevent false-positives (Twigpine#1201) Notes: - 2c755d3: react-compiler compiled output (add-dir.tsx) replaced with typed source; build re-compiles on next run - 47eea3f: kept fork-specific // @ts-nocheck at top of GlobalSearchDialog.tsx (added by local b40814b, not in upstream); applied type Props + true arg - 96ddec7: bun.lock regenerated via 'bun install' to reconcile with new package.json (devDependencies pruned: react-hooks, react-test-renderer); new use-input.test.ts (208 lines) injected via StdinContext.Provider - 1fc5116: new runtimeMetadata.test.ts (90 lines, regression coverage for the segment-boundary heuristic per jatmn review) Verification: baseline: 2223 pass / 23 skip / 4 fail after: 2232 pass / 23 skip / 2 fail (+9 pass, -2 fail) typecheck: 90 errors (pre-existing, no new) build: Built v0.16.1 Rebase onto OpenCC v0.14.0 (2292a59).
…pine#1501) Per-file port of upstream 96ddec7. 1 file (use-input.test.ts). 3way conflict at the `tick()` helper (fork had setTimeout-based 5ms wait, upstream now uses `Bun.sleep(5)`): took theirs. Added `// @ts-nocheck` at line 1 since `@types/bun` is not installed; runtime is fine, only the type checker complains. Source: upstream 96ddec7
The use-input.test.ts added in #1198 broke the full
bun testrun two ways:@testing-library/react-hooks, which was never installed and is React 16/17/18-only (incompatible with this repo's React 19), so the file errored on load.vi.mock('./use-stdin.js', …)registered a module mock that leaks across every later file in the samebun testprocess. The fake eventEmitter's.onwas a no-op, souseInputsilently registered no listener and dropped all keystrokes — surfacing as timeouts in MonitorPermissionRequest and the agent-menu/wizard TextInput tests (which passed in isolation but failed in the full suite).Rewrite the test to inject the stdin handle via StdinContext.Provider (no leaking global mock) and render through the real ink root (no @testing-library/react-hooks). Drop the now-dead react-hooks and react-test-renderer devDependencies and reconcile the lockfile.
Full suite: 3429 pass, 0 fail (was 9 fail + 1 error).
Summary by CodeRabbit
Chores
Tests