Repository navigation
test(local): run the frontend tests in UTC - #2050
Conversation
license-settings.test.tsx expects "Sep 10, 2027" for an expiry of 2027-09-10T00:00:00Z, but the component formats the instant in the machine's local zone, so west of UTC it reads "Sep 9, 2027" and the suite fails on a laptop while passing in CI. Pin the zone vitest runs in rather than every assertion that spells out a day.
|
@ybai08 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
vite.config.tspinsTZ=UTCfor vitest (test.env), with a comment saying why.Why
license-settings.test.tsx("imports a picked .lic file and shows whose plan it is") expectsExpires Sep 10, 2027for an expiry of2027-09-10T00:00:00Z, but Settings formats that instant in the machine's local zone. On a laptop west of UTC it rendersSep 9, 2027and the test fails, deterministically, while CI on UTC passes. I hit it runningpnpm testbefore opening #2049 on this branch's sibling.Pinning the zone the suite runs in is the smallest fix and keeps every day-spelling assertion honest. Whether Settings should show a licence expiry as a calendar date rather than a local-time instant is a separate question I have not touched.
Fixes nothing filed; found while working on #1949.
How to test
Whole frontend suite green locally with no
TZin the shell;prettier --checkandeslintclean on the config.High-level PR Summary
This PR fixes a timezone-related test flakiness issue by pinning the timezone to UTC when running frontend tests. The problem occurred when
license-settings.test.tsxexpected a date to display as Sep 10, 2027 for a UTC instant of2027-09-10T00:00:00Z, but on machines in timezones west of UTC (likeAmerica/Chicago), it would render as Sep 9, 2027, causing the test to fail locally while passing in CI. The fix addsTZ=UTCto the vitest environment configuration invite.config.ts, ensuring consistent test behavior across all environments without needing to modify individual test assertions.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_local/frontend/vite.config.ts