fix(mobile): keep colocated tests out of the Metro bundle - #5046
Merged
Conversation
Expo Router's require.context matches every .tsx under src/app. A colocated *.test.tsx registered as a route and pulled vitest, and therefore vite, into the bundle. Metro cannot transform vite's dynamic import, so export:embed failed. Block *.test.* under apps/mobile/src in the Metro resolver.
jeanduplessis
approved these changes
Aug 5, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous Review Summary (commit 9a3e650)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 9a3e650)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (1 file)
Reviewed by kimi-k3 · Input: 32.7K · Output: 4.6K · Cached: 173.1K Review guidance: REVIEW.md from base branch |
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
jeanduplessis
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The iOS EAS build fails at bundle time:
Cause
apps/mobile/src/app/(app)/(tabs)/(2_agents)/index.mounted.test.tsxlives inside the router root. Expo Router'srequire.contextmatches every.tsxundersrc/app, so the test file registered as a route. That pulledvitestinto the bundle, which importsvite/module-runner, which Metro cannot transform.Fix
Block
*.test.*underapps/mobile/srcin the Metro resolver. This also covers any future colocated test.Verification
pnpm expo export:embed --eager --platform ios --dev falseexits 0 (5776 modules; failed before the fix).pnpm test: 362 files, 3548 tests pass. Vitest uses its own resolver, so the block list does not affect it.