fix(tests): resolve 5 cross-file test isolation failures#2841
Merged
code-yeongyu merged 1 commit intodevfrom Mar 26, 2026
Merged
fix(tests): resolve 5 cross-file test isolation failures#2841code-yeongyu merged 1 commit intodevfrom
code-yeongyu merged 1 commit intodevfrom
Conversation
- model-fallback hook: mock selectFallbackProvider and add _resetForTesting() to test-setup.ts to clear module-level state between files - fallback-retry-handler: add afterAll(mock.restore) and use mockReturnValueOnce to prevent connected-providers mock leaking to subsequent test files - opencode-config-dir: use win32.join for Windows APPDATA path construction so tests pass on macOS (path.join uses POSIX semantics regardless of process.platform override) - system-loaded-version: use resolveSymlink from file-utils instead of realpathSync to handle macOS /var -> /private/var symlink consistently All 4456 tests pass (0 failures) on full bun test suite.
There was a problem hiding this comment.
No issues found across 8 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes test isolation and cross-platform path issues using standard cleanup patterns. Addresses macOS symlink and Windows path normalization in tests. Low risk, improves suite stability.
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.
Summary
Fixes 5 test failures that only appear in the full
bun testsuite (4456 tests across 424 files) but pass individually.Root Causes & Fixes
1-2. model-fallback hook (2 failures)
Cause:
fallback-retry-handler.test.tsmockedreadProviderModelsCachewithmockReturnValue(permanent) and usedmock.modulewithoutmock.restore(). The mock leaked to the model-fallback hook test, overriding its own mock with stale connected-provider state.Fix:
afterAll(() => mock.restore())to fallback-retry-handler testmockReturnValue→mockReturnValueOncefor provider mocks_resetForTesting()to model-fallback hook (clearspendingModelFallbacks,lastToastKey,sessionFallbackChains)selectFallbackProvidermock to hook test for full isolationtest-setup.tsnow resets model-fallback state inbeforeEach3. opencode-config-dir Windows test (1 failure)
Cause:
path.join('C:\\...', name)on macOS prepends CWD becauseC:\\isn't an absolute path on POSIX.process.platform = 'win32'override doesn't changepath.joinbehavior.Fix: Use
win32.joinin both implementation (getTauriConfigDir) and test assertion.4-5. system-loaded-version symlink (2 failures)
Cause:
mkdtempSyncreturns/var/folders/...butrealpathSyncreturns/private/var/folders/...on macOS (/var→/private/varsymlink).Fix: Use
resolveSymlinkfromfile-utils(which already handles this normalization) instead of rawrealpathSync.Verification