cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

Moving from jest to vitest

Open leog opened this issue 2 years ago • 7 comments
trafficstars

What does this PR do?

Moving unit testing framework from Jest to Vitest in order to speed things up.

Going from this:

To this:

Marking a 85.3% decrease in time, even running more tests than Jest.

Type of change

  • Chore (refactoring code, technical debt, workflow improvements)

leog avatar May 22 '23 13:05 leog

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2023 11:15pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
ui ⬜️ Ignored (Inspect) Visit Preview May 24, 2023 11:15pm

vercel[bot] avatar May 22 '23 13:05 vercel[bot]

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

➕ Added Package Capability Access +/- Transitive Count Publisher
[email protected] None +8 domenic
[email protected] None +1 eratio
[email protected] None +2 simenb

🚮 Removed packages: @types/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]

socket-security[bot] avatar May 22 '23 13:05 socket-security[bot]

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

github-actions[bot] avatar May 22 '23 13:05 github-actions[bot]

Current Playwright Test Results Summary

✅ 114 Passing - ⚠️ 6 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 05/24/2023 11:34:59pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 27ef504ab22226125a7d751a65450df0ac8230d9

Started: 05/24/2023 11:20:58pm UTC

⚠️ Flakes

📄   apps/web/playwright/reschedule.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Reschedule Tests -- new-booker Should do a booking request reschedule from /bookings
Retry 1Initial Attempt
0.77% (3) 3 / 388 runs
failed over last 7 days
1.80% (7) 7 / 388 runs
flaked over last 7 days
Reschedule Tests -- old-booker Opt in event should be ACCEPTED when rescheduled by OWNER
Retry 1Initial Attempt
0% (0) 0 / 375 runs
failed over last 7 days
2.40% (9) 9 / 375 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests user -- old-booker can duplicate an existing event type
Retry 1Initial Attempt
0% (0) 0 / 394 runs
failed over last 7 days
1.27% (5) 5 / 394 runs
flaked over last 7 days

📄   apps/web/playwright/embed-code-generator.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Embed Code Generator Tests Event Type Edit Page open Embed Dialog for the Event Type
Retry 1Initial Attempt
3.27% (13) 13 / 397 runs
failed over last 7 days
29.97% (119) 119 / 397 runs
flaked over last 7 days

📄   apps/web/playwright/booking-seats.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking with Seats -- new-booker Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
0% (0) 0 / 406 runs
failed over last 7 days
85.47% (347) 347 / 406 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
9.09% (1) 1 / 11 run
failed over last 7 days
36.36% (4) 4 / 11 runs
flaked over last 7 days

View Detailed Build Results


deploysentinel[bot] avatar May 22 '23 17:05 deploysentinel[bot]

I'm loving this! Nice job @leog

Just for completeness sake. What are the drawbacks of abandoning jest in our codebase?

zomars avatar May 22 '23 22:05 zomars

happy to merge once open questions were answered. changes can be done in a follow up PR

PeerRich avatar May 23 '23 08:05 PeerRich

Just for completeness sake. What are the drawbacks of abandoning jest in our codebase?

@zomars There is no apparent drawback other than immersing ourselves into a new framework which can lead to unknowns although Vitest is being used more and more these days. Not to mention Vitest has been designed with a Jest compatible API. More info about migration and similarities/differences here.

All in all, I think we should give it a chance, the time difference is huge, and locally is ludicrous, see: image

leog avatar May 23 '23 13:05 leog