Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

Description

Fixes test failures caused by Vitest v4's stricter constructor mock requirements.

In Vitest v4, vi.fn().mockReturnValue() doesn't work when the mock is invoked with new. The ResizeObserver and IntersectionObserver mocks were failing because they returned plain objects instead of being proper constructor functions.

Before (broken):

const mockResizeObserver = vi.fn()
mockResizeObserver.mockReturnValue({
  observe: () => null,
  unobserve: () => null,
  disconnect: () => null,
})

After (fixed):

;(globalThis as any).ResizeObserver = vi.fn(function (this: any) {
  this.observe = vi.fn()
  this.unobserve = vi.fn()
  this.disconnect = vi.fn()
})

What to review

  • packages/sanity/test/setup/environment.ts - updated mock implementations

Testing

Verified locally that previously failing tests now pass (useDocumentSheetColumns, DeletedDocumentBanners, useDocumentTitle, DocumentHeaderTitle, PaneContainer).

Notes for release

Not required - internal test infrastructure change only.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
page-building-studio Ready Ready Preview Comment Nov 25, 2025 1:41pm
test-studio Ready Ready Preview Comment Nov 25, 2025 1:41pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
studio-workshop Ignored Ignored Preview Nov 25, 2025 1:41pm
test-next-studio Ignored Ignored Nov 25, 2025 1:41pm

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

🧪 E2E Preview environment

🔑 Environment Variables for Local Testing

This is the preview URL for the E2E tests: https://e2e-studio-qk38selvm.sanity.dev

To run the E2E tests locally, you can use the following environment variables, then run pnpm test:e2e --ui to open the Playwright test runner.

💬 Remember to build the project first with pnpm build:e2e.

  SANITY_E2E_PROJECT_ID=ittbm412
  SANITY_E2E_BASE_URL=https://e2e-studio-qk38selvm.sanity.dev
  SANITY_E2E_DATASET="update depending the project you want to test (pr-11262-chromium-19671364346 || pr-11262-firefox-19671364346 )"
  SANITY_E2E_DATASET_CHROMIUM=pr-11262-chromium-19671364346
  SANITY_E2E_DATASET_FIREFOX=pr-11262-firefox-19671364346

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

⚡️ Editor Performance Report

Deploying studio and running performance tests…

Copy link
Contributor Author

Copilot AI commented Nov 25, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update vitest monorepo to v4 (major) fix: update ResizeObserver and IntersectionObserver mocks for vitest v4 Nov 25, 2025
Copilot AI requested a review from bjoerge November 25, 2025 14:01
Copilot finished work on behalf of bjoerge November 25, 2025 14:01
@renovate renovate bot force-pushed the renovate/major-4-vitest-monorepo branch 8 times, most recently from 1181ad4 to bab00aa Compare November 28, 2025 14:43
@bjoerge bjoerge closed this Dec 2, 2025
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