Skip to content

fix(mobile): keep colocated tests out of the Metro bundle - #5046

Merged
iscekic merged 2 commits into
mainfrom
fix/mobile-metro-block-colocated-tests
Aug 5, 2026
Merged

fix(mobile): keep colocated tests out of the Metro bundle#5046
iscekic merged 2 commits into
mainfrom
fix/mobile-metro-block-colocated-tests

Conversation

@iscekic

@iscekic iscekic commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The iOS EAS build fails at bundle time:

vite/dist/node/module-runner.js: Invalid call at line 1009: import(filepath)
pnpm expo export:embed --eager --platform ios --dev false exited with non-zero code: 1

Cause

apps/mobile/src/app/(app)/(tabs)/(2_agents)/index.mounted.test.tsx lives inside the router root. Expo Router's require.context matches every .tsx under src/app, so the test file registered as a route. That pulled vitest into the bundle, which imports vite/module-runner, which Metro cannot transform.

Fix

Block *.test.* under apps/mobile/src in the Metro resolver. This also covers any future colocated test.

Verification

  • pnpm expo export:embed --eager --platform ios --dev false exits 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.

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.
@iscekic iscekic self-assigned this Aug 5, 2026
@iscekic
iscekic requested a review from jeanduplessis August 5, 2026 15:57
@iscekic
iscekic enabled auto-merge (squash) August 5, 2026 15:58
Comment thread apps/mobile/metro.config.js Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • apps/mobile/metro.config.js
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

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
apps/mobile/metro.config.js 24 ...config.resolver.blockList spread lacks the || [] fallback used by adjacent config lines; Metro types blockList as optional, so an undefined value would throw at config load
Files Reviewed (1 file)
  • apps/mobile/metro.config.js - 1 issue

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 32.7K · Output: 4.6K · Cached: 173.1K

Review guidance: REVIEW.md from base branch main

Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
@iscekic
iscekic merged commit 1398416 into main Aug 5, 2026
20 checks passed
@iscekic
iscekic deleted the fix/mobile-metro-block-colocated-tests branch August 5, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants