Commit 8c5ce80
committed
fix: resolve CI module linking errors by isolating test mocks from production dependencies
## Root Cause Analysis
CI was failing with 78 "module is already linked" errors due to import chain:
test files → utils/command.js → utils/logger.js → @sentry/node → native modules
This chain caused Vitest's vmThreads pool to load native modules multiple times
across VM contexts, triggering Linux glibc's module linking restrictions.
## Solution: Surgical Mock Function Migration
- Created isolated test-utils/mock-executors.ts with exact copies of mock functions
- Removed all mock functions from utils/command.ts (production dependency chain)
- Updated 54+ test files to import mocks from test-utils/mock-executors.js
- Extracted CommandExecutor and FileSystemExecutor interfaces to separate files
- Maintained zero behavioral changes to preserve all 1046 passing tests
## Key Changes
- NEW: src/test-utils/mock-executors.ts - Isolated test mocks (no production deps)
- NEW: src/utils/CommandExecutor.ts - Command executor interface
- NEW: src/utils/FileSystemExecutor.ts - File system executor interface
- MODIFIED: src/utils/command.ts - Removed mock functions, kept production executors
- MODIFIED: 54+ test files - Updated imports to use isolated test-utils
## Import Chain Resolution
BEFORE: test files → utils/command.js → utils/logger.js → @sentry/node (BROKEN)
AFTER: test files → test-utils/mock-executors.js (ISOLATED ✅)
## Verification
- All 1046 tests pass locally with surgical migration
- Linting and TypeScript compilation clean
- Production command execution unchanged
- Test mock behavior preserved exactly
Resolves Ubuntu CI "module is already linked" errors while maintaining
test reliability and production functionality.1 parent 29fb327 commit 8c5ce80
77 files changed
Lines changed: 417 additions & 751 deletions
File tree
- docs
- scripts
- src
- mcp
- resources/__tests__
- tools
- device
- __tests__
- logging
- __tests__
- macos
- __tests__
- project-discovery
- __tests__
- project-scaffolding
- __tests__
- simulator-management/__tests__
- simulator/__tests__
- swift-package/__tests__
- ui-testing/__tests__
- utilities/__tests__
- test-utils
- utils
- __tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
This file was deleted.
This file was deleted.
0 commit comments