mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary - Fixes #25972: TestReporter domain events not firing when debugger connects after test discovery When a debugger client connects and enables the TestReporter domain after tests have been discovered (e.g., using `--inspect` instead of `--inspect-wait`), the `TestReporter.found`, `TestReporter.start`, and `TestReporter.end` events would not fire. This is because tests discovered without an enabled debugger have `test_id_for_debugger = 0`, and the event emission code checks for non-zero IDs. The fix retroactively assigns test IDs and reports discovered tests when `TestReporter.enable` is called: 1. Check if there's an active test file in collection or execution phase 2. Iterate through the test tree (DescribeScopes and test entries) 3. Assign unique `test_id_for_debugger` values to each test/describe 4. Send `TestReporter.found` events for each discovered test ## Test plan - [ ] Verify IDE integrations can now receive test telemetry when connecting after test discovery - [ ] Ensure existing `--inspect-wait` behavior continues to work (debugger enabled before discovery) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>