fix(tests): ensure logger mock isolation in version-check tests#71
Conversation
|
Caution Review failedPull request was closed or merged during review Note
|
| Layer / File(s) | Summary |
|---|---|
Mock Reset Setup src/__tests__/version-check.test.ts |
Before each checkForUpdates test, logger.error mock is reset via vi.mocked(logger.error).mockReset() to ensure prior assertions and call counts do not bleed into subsequent tests. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~2 minutes
Possibly related PRs
- KDM-cli/kdm-cli#41: Both PRs modify
logger.errormocking insrc/__tests__/version-check.test.ts—fix: version check logic and validation #41 establishes the mocked behavior, and this PR adds per-test reset for isolation.
Poem
🧹 A mock reset between each test,
No cross-test spills, just staying blessed,
One tiny line, so clean and tight,
Isolation glows—tests burn bright! ✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: adding logger mock isolation to version-check tests to fix test pollution issues. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Comment @coderabbitai help to get the list of available commands and usage tips.
This PR fixes a test pollution issue where the 'logger.error' mock was not being reset between tests, causing failures when upgrading Vitest. This resolves the CI failures seen in several Dependabot PRs.
Summary by CodeRabbit