Skip to content

Conversation

@volnei
Copy link
Contributor

@volnei volnei commented Dec 31, 2025

What does this PR do?

Upgrades Vitest from 2.1.9 to 4.0.16 and Vite from 4.5.14/5.4.21 to 6.4.1 across the monorepo, including all necessary breaking change fixes.

Package updates:

  • vitest: 2.1.9 → 4.0.16
  • @vitest/ui: 2.1.9 → 4.0.16
  • vitest-fetch-mock: 0.3.0 → 0.4.5
  • vitest-mock-extended: 2.0.2 → 3.1.0
  • vite: 4.5.14/5.4.21 → 6.4.1 (across embed-core, embed-react, embed-snippet, atoms, libraries)
  • @vitejs/plugin-basic-ssl: 1.1.0 → 2.1.0
  • @vitejs/plugin-react: 2.2.0 → 5.1.2
  • @vitejs/plugin-react-swc: 3.7.0 → 4.2.2
  • vite-plugin-dts: 3.7.3 → 4.5.4

Config changes:

  • Renamed vitest.config.ts to vitest.config.mts for ESM compatibility with Vitest 4.0
  • Added globals: true to vitest config to maintain describe/it/expect global availability
  • Added exclude pattern for apps/api/v2/**/*.spec.ts (these files use Jest, not Vitest)

Breaking change fixes:

  • Converted ~50 arrow function mockImplementation(() => ...) patterns to regular functions mockImplementation(function() { return ...; }) (Vitest 4.0 breaking change: arrow functions can no longer be used as constructor mocks)
  • Added ?inline suffix to CSS imports in embed-core for Vite 6 compatibility
  • Added biome override to disable useArrowFunction lint rule for test files to prevent lint conflicts with the Vitest 4.0 requirement

Updates since last revision:

  • Fixed VerificationTokenService mock in paymentCallback.test.ts to properly mock the static create method
  • Fixed RoutingFormResponseRepository constructor mock in queued-response.test.ts
  • Fixed EventTypeRepository constructor mock in duplicate.handler.test.ts
  • Fixed PermissionCheckService constructor mocks in inviteMemberUtils.test.ts
  • Fixed CreditService constructor mocks in CallService.test.ts
  • Excluded API v2 *.spec.ts files from Vitest (they use Jest globals)

Known issue (pre-existing, not caused by this upgrade):

  • duplicate.handler.test.ts expects BAD_REQUEST but the handler now returns CONFLICT for P2002 errors - this test expectation is outdated and should be fixed separately

Requested by: Volnei Munhoz (@volnei)
Link to Devin run: https://app.devin.ai/sessions/49389474d1244630988cb37954dcd10f

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Run yarn install to update dependencies
  2. Run yarn workspace @calcom/embed-core build to verify embed packages build with Vite 6
  3. Run TZ=UTC yarn test to verify tests pass with Vitest 4.0.16
  4. Run yarn type-check:ci --force to verify no type errors

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify the arrow function → regular function conversions are syntactically correct (look for function() { return ...; } patterns)
  • Verify embed packages build correctly with Vite 6 CSS ?inline changes
  • Verify the API v2 *.spec.ts exclusion is appropriate (these files use Jest, not Vitest)
  • Verify tests pass in CI
  • Check if duplicate.handler.test.ts test expectation should be updated separately (expects BAD_REQUEST but handler returns CONFLICT)
  • Verify the biome override for test files doesn't mask other issues

- Update vitest from 2.1.9 to 4.0.16
- Update @vitest/ui from 2.1.9 to 4.0.16
- Update vitest-fetch-mock from 0.3.0 to 0.4.5
- Update vitest-mock-extended from 2.0.2 to 3.1.0
- Update vite from 4.5.14/5.4.21 to 6.4.1 across all packages
- Update @vitejs/plugin-react to 5.1.2
- Update @vitejs/plugin-react-swc to 4.2.2
- Update @vitejs/plugin-basic-ssl to 2.1.0
- Update vite-plugin-dts to 4.5.4
- Rename vitest.config.ts to vitest.config.mts for ESM compatibility
- Add globals: true to vitest config

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
@vercel
Copy link

vercel bot commented Dec 31, 2025

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

3 Skipped Deployments
Project Deployment Review Updated (UTC)
cal Ignored Ignored Dec 31, 2025 9:20pm
cal-companion Ignored Ignored Preview Dec 31, 2025 9:20pm
cal-eu Ignored Ignored Dec 31, 2025 9:20pm

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits December 31, 2025 16:30
- Convert arrow function mockImplementation patterns to regular functions
  (Vitest 4.0 breaking change: arrow functions can't be constructor mocks)
- Fix CSS imports with ?inline suffix for Vite 6 compatibility
- Add biome override to disable useArrowFunction rule for test files
- Fix syntax errors in test files introduced by regex replacements

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

E2E results are ready!

devin-ai-integration bot and others added 3 commits December 31, 2025 16:49
… spec files

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…t 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
devin-ai-integration bot and others added 2 commits December 31, 2025 17:13
…t 4.0

- Fix CrmService.integration.test.ts jsforce.Connection mock
- Fix RetellSDKClient.test.ts Retell mock
- Fix RetellAIService.test.ts CreditService mocks
- Fix GoogleCalendarSubscriptionAdapter.test.ts CalendarAuth mock

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…r Vitest 4.0

- Fix googleapis.ts Calendar, OAuth2Client, and JWT mocks
- Fix utils.ts JWT mock
- Fix OAuthManager.ts defaultMockOAuthManager mock

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
devin-ai-integration bot and others added 2 commits December 31, 2025 17:50
…cks for Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
… Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
devin-ai-integration bot and others added 4 commits December 31, 2025 18:32
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…s for Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…unction for Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
devin-ai-integration bot and others added 5 commits December 31, 2025 19:46
- Fix Response constructor 204 status code issue in testUtils.ts
- Fix FeaturesRepository mock persistence in handleNotificationWhenNoSlots.test.ts
- Add @vitest-environment node directive to formSubmissionUtils.test.ts
- Fix document.querySelector mock in embed.test.ts

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
…or Vitest 4.0

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
devin-ai-integration bot and others added 5 commits December 31, 2025 20:22
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
- Fix booking-validations.test.ts: convert UserRepository mock to regular function
- Fix route.test.ts: update 500 error test to mock ImageResponse instead of fetch
- Fix users-public-view.test.tsx: add missing mocks for getOrgFullOrigin and useRouterQuery
- Add @calcom/web path alias to vitest config

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
- Add svg-hashes.json mock for route.test.ts
- Add tailwind.generated.css mock for embed.test.ts
- Update vitest config to use mock files

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
- Use array format for aliases to ensure proper ordering
- Add @calcom/platform-constants alias to resolve from source
- Add @calcom/embed-react alias to resolve from source
- Ensure svg-hashes.json mock alias is matched before @calcom/web

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants