Skip to content

test(local): run the frontend tests in UTC - #2050

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
ybai08:test/frontend-utc-timezone
Sep 29, 2026
Merged

MODSetter merged 1 commit into
MODSetter:devfrom
ybai08:test/frontend-utc-timezone

Conversation

@ybai08

@ybai08 ybai08 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What

vite.config.ts pins TZ=UTC for vitest (test.env), with a comment saying why.

Why

license-settings.test.tsx ("imports a picked .lic file and shows whose plan it is") expects Expires Sep 10, 2027 for an expiry of 2027-09-10T00:00:00Z, but Settings formats that instant in the machine's local zone. On a laptop west of UTC it renders Sep 9, 2027 and the test fails, deterministically, while CI on UTC passes. I hit it running pnpm test before 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

cd surfsense_local/frontend
TZ=America/Chicago pnpm test   # fails on dev in the license test, passes here
pnpm test

Whole frontend suite green locally with no TZ in the shell; prettier --check and eslint clean 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.tsx expected a date to display as Sep 10, 2027 for a UTC instant of 2027-09-10T00:00:00Z, but on machines in timezones west of UTC (like America/Chicago), it would render as Sep 9, 2027, causing the test to fail locally while passing in CI. The fix adds TZ=UTC to the vitest environment configuration in vite.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
Order File Path
1 surfsense_local/frontend/vite.config.ts

Need help? Join our Discord

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.
@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown

@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.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 870c4566-00d7-4be4-b1f7-bec17e33e2d4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MODSetter
MODSetter merged commit 127838f into MODSetter:dev Sep 29, 2026
17 of 19 checks passed
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