mirror of
https://github.com/expo/expo-agent-cli.git
synced 2026-11-15 03:58:08 -10:00
## Bug fix A crash inside an e2e test worker shows no error in CI. The macOS job on run [43228731197](https://github.com/expo/expo-agent-cli/actions/runs/43228731197) shows only: ``` Error: process.exit unexpectedly called with "1" at process.handleUncaughtException (.../src/utils/errors.ts:496:11) ``` Root cause: `src/utils/errors.ts` registered `process.on('uncaughtException', handleUncaughtException)` as a module side effect. E2E tests import `src/` modules, so the handler is also installed in the vitest worker. For example, `stop-test.ts` reaches `errors.ts` through `installedAppStubs.ts` → `src/deviceBinding/tools.ts` → `src/device/adb.ts`. A crash in the worker then calls `process.exit(1)`, and the real error and its stack never reach the job log. ### Steps to reproduce 1. In any e2e test, `await import('../../src/utils/errors')`. 2. Compare `process.listeners('uncaughtException')` before and after: the import adds one. ## How `src/cli.ts`, the one CLI entry, registers the handler. `errors.ts` only exports it. The telemetry worker bundle never loaded `errors.ts`, so nothing else changes. ## Alternatives considered Remove the listener in an e2e setup file. Rejected: it fixes one consumer and leaves the side effect in place for the next one. ## Verification - Checked by hand on main: `await import('../../src/utils/errors')` in an e2e test adds one `uncaughtException` listener. With this change, it adds none. No test is added. - `bun run typecheck` and oxlint are clean. - Unit suite: 5805 passed, 1 failed. The failure is `statusAsync-test.ts` (`vi.getTimerCount()` is 1), and it fails the same way on main on my Mac, so this change does not cause it. This does not fix the macOS crash itself. It makes the next one show its error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>