Skip to content

fix(web): vitest 4 compatible fetch spy in recipes.test - #42

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
fluxis:fix/vitest4-recipes-spy
Jun 2, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
fluxis:fix/vitest4-recipes-spy

Conversation

@fluxis

@fluxis fluxis commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

origin/main currently fails pnpm test after the vitest 4.1.0 bump. recipes.test.ts casts the fetch spy with vi.spyOn(global, "fetch" as never), which vitest 4's stricter typings reject, breaking the build.

This swaps the four occurrences to vi.spyOn(globalThis, "fetch"), which type-checks cleanly under vitest 4 and is the idiomatic form.

Isolated hotfix — no behavior change, one file, four lines. Splitting it out so the broken main is un-blocked independently of any in-flight feature work.

Test Plan

  • cd web && pnpm exec vitest run src/lib/recipes.test.ts → 3/3 pass on vitest 4.1.0
  • CI green on the PR

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

No user-facing changes in this release. This update includes internal testing infrastructure improvements with no impact on functionality or user experience.

…ld after vitest 4.1.0 bump)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f30a4cd-de88-44c3-8048-571324d1e75f

📥 Commits

Reviewing files that changed from the base of the PR and between d297192 and 75fbc94.

📒 Files selected for processing (1)
  • web/src/lib/recipes.test.ts

📝 Walkthrough

Walkthrough

This PR updates Vitest mock spy targets in the recipes test file from global.fetch to globalThis.fetch. The change is applied consistently across the shared beforeEach setup and all three test cases that stub fetch responses, with no changes to test assertions or response payloads.

Changes

Fetch Mock Target Update

Layer / File(s) Summary
Update fetch mock targets
web/src/lib/recipes.test.ts
Changed vi.spyOn target from global.fetch to globalThis.fetch in the beforeEach hook, fetchRecipeCatalog, fetchCandidates, and previewSection tests.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through test arrays bright,
Swapping global for globalThis with all its might,
Mock targets dance from old to new,
Fetch now spies on what is true! 🐰✨

🚥 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 and concisely describes the main change: updating vitest mocks from global.fetch to globalThis.fetch for vitest 4 compatibility.
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.

@Quick104
Quick104 merged commit a70d2e8 into Silo-Server:main Jun 2, 2026
1 check passed
Quick104 added a commit to thezak48/silo-server that referenced this pull request Jun 7, 2026
@fluxis
fluxis deleted the fix/vitest4-recipes-spy branch June 9, 2026 17:32
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.

2 participants