[Refactor] Add test-utils guardrails and convert remaining stragglers - #1206
Draft
zoomote[bot] wants to merge 1 commit into
Draft
[Refactor] Add test-utils guardrails and convert remaining stragglers#1206zoomote[bot] wants to merge 1 commit into
zoomote[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Roomote <roomote@roomote.dev>
Contributor
Author
|
Author self-review summary:
Per initiative policy, not approving this Roomote-authored PR — leaving review to a human maintainer. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Related GitHub Issue
N/A: Phase 4 test-utils rollout guardrails.
Description
Adds lightweight guardrails so the Phase 3 test-utils migration cannot regress, per the initiative plan's Phase 4:
src/eslint.config.mjs:no-restricted-syntaxerror onvi.clearAllMocks()/vitest.clearAllMocks()scoped to the converted extension lanes (api/providers/__tests__,core/config/__tests__,services/code-index/**/__tests__,integrations/terminal/**/__tests__), pointing authors atsrc/test-utils/reset.webview-ui/eslint.config.mjs:no-restricted-importserror on importingQueryClientProviderin component specs (src/components/**/__tests__/**/*.tsx), pointing authors atrenderWithExtensionState. Scoped to.tsxcomponent specs intentionally —.tshook specs keep localrenderHookwrappers because they pass a specificQueryClientinstance to the hook.Two stragglers found while verifying the guardrail are converted here so the rules land green:
CustomModesManager.spec.ts: 9 remaining directvi.clearAllMocks()call sites missed by [Refactor] Reuse shared CustomModesManager test helpers #1190 (helper was already imported).useSelectedModel.spec.ts/useZooGatewayRouterModelsSync.spec.ts: hand-rollednew QueryClient({ queries: { retry: false } })replaced with the sharedcreateTestQueryClient().Both rules were probe-tested: a temporary offending file in each lane errors with the intended message.
This is a test-and-lint-config-only change with no intended runtime or user-facing behavior change.
Test Procedure
pnpm exec vitest run core/config/__tests__/CustomModesManager.spec.tsfromsrc(48 tests passed)pnpm exec vitest run src/components/ui/hooks/__tests__/useZooGatewayRouterModelsSync.spec.ts src/components/ui/hooks/__tests__/useSelectedModel.spec.tsfromwebview-ui(48 + 42 tests passed)pnpm test(extension: 445 files, 7,355 tests; webview: 145 files, 1,643 tests)pnpm lintpnpm check-types--max-warnings=0;src/eslint-suppressions.jsonunchanged.Pre-Submission Checklist
src/test-utils/,@/utils/test-utils) are used only for mechanical duplication; test intent and scenario-specific mocks remain visible.Visual Snapshots
Not applicable; no product UI changed.
Videos (interaction / animation only)
Not applicable; no product interaction changed.
Documentation Updates
Additional Notes
No changesets were added. Author self-review found no behavior or scope regressions. The
.tsxscoping of the webview rule is deliberate; hook specs that need a specificQueryClientinstance keep localrenderHookwrappers but now sharecreateTestQueryClient().Get in Touch
Mention
@roomoteon this PR for follow-up requests.