← Back to PRs

#21500: fix(test): resolve vi.mock hoisting failures on macOS runners

by irchelper open 2026-02-20 01:09 View on GitHub →
channel: bluebubbles channel: discord size: S
Fix macOS-specific vi.mock hoisting failures (pre-existing, unrelated to any open feature PR). On macOS Vitest runners, module-scope vi.fn() in vi.mock factories can be undefined after hoisting. Wrapping with vi.hoisted() ensures correct initialization order. Files changed: actions.test.ts, media-send.test.ts, test-mocks.ts, feishu/media.test.ts, exec-approvals.test.ts, message-action-runner.test.ts <!-- greptile_comment --> <h3>Greptile Summary</h3> Wraps module-scope `vi.fn()` calls in `vi.hoisted()` to fix macOS-specific Vitest hoisting failures where mocks could be undefined after hoisting. The changes update 4 test files to use the correct initialization order for mock factories. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no risk - The changes are minimal, focused test-only fixes that follow established patterns used extensively throughout the codebase (172 other files use `vi.hoisted`). The fixes address a real macOS-specific testing issue without touching production code. - No files require special attention <sub>Last reviewed commit: 8b6c3b6</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs