Skip to content

[Task 5] Fix shell integration test isolation#73

Merged
arittr merged 1 commit into750f25-task-4-update-documentationfrom
750f25-task-5-fix-test-isolation
Nov 3, 2025
Merged

[Task 5] Fix shell integration test isolation#73
arittr merged 1 commit into750f25-task-4-update-documentationfrom
750f25-task-5-fix-test-isolation

Conversation

@arittr
Copy link
Owner

@arittr arittr commented Nov 3, 2025

Fix mock pollution in shell integration tests by using cache-busting dynamic imports.

Issue: Agent unit tests use mock.module() which creates persistent module mocks. Even after mock.restore(), Bun's module cache still serves the mocked version to subsequent imports.

Solution:

  • Dynamically import shell module in beforeAll hook after calling mock.restore()
  • Add timestamp query parameter to force fresh import and bypass module cache
  • Rename test file to zzz-shell.integration.test.ts for consistent ordering

Result: All 14 failing tests now pass

  • Before: 568 pass, 14 fail
  • After: 582 pass, 0 fail

Tests verified: bun test completes successfully

Fix mock pollution in shell integration tests by using cache-busting dynamic imports.

Issue: Agent unit tests use mock.module() which creates persistent module mocks. Even after mock.restore(), Bun's module cache still serves the mocked version to subsequent imports.

Solution:
- Dynamically import shell module in beforeAll hook after calling mock.restore()
- Add timestamp query parameter to force fresh import and bypass module cache
- Rename test file to zzz-shell.integration.test.ts for consistent ordering

Result: All 14 failing tests now pass
- Before: 568 pass, 14 fail
- After: 582 pass, 0 fail

Tests verified: bun test completes successfully
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.

1 participant

Comments