Skip to content

Pin vitest timezone to UTC for deterministic date tests - #58

Merged
rstover-fo merged 1 commit into
mainfrom
claude/cool-dubinsky-df1a34
Sep 4, 2026
Merged

rstover-fo merged 1 commit into
mainfrom
claude/cool-dubinsky-df1a34

Conversation

@rstover-fo

@rstover-fo rstover-fo commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • GameRecap.test.tsx and PredictionCard.test.tsx failed on a clean checkout of main in any US timezone: both components format timestamps with toLocaleDateString in local time, and their fixtures (2026-07-20T04:00:00Z, 2025-11-28T09:10:00+00:00) roll back a calendar day outside UTC.
  • Fix is a single line in vitest.config.ts: process.env.TZ = 'UTC' before the config export. Workers inherit it, so every date-rendering test is deterministic across machines and CI, not just these two. No component or fixture changes.

Test plan

  • npx vitest run src/components/game/__tests__/GameRecap.test.tsx src/components/game/__tests__/PredictionCard.test.tsx passes
  • Same two tests pass with TZ=America/Chicago forced in the shell
  • npm run test passes (150 files, 1603 tests)

🤖 Generated with Claude Code

Greptile Summary

Summary

  • Pins the root Vitest process timezone to UTC before test configuration is exported.
  • This makes date-only component rendering deterministic across developer machines and CI environments.
  • The focused game date test suite passes when launched from a US timezone.

Confidence Score: 5/5

Safe to merge; the timezone pin fixes the demonstrated date-rendering variance without changing application behavior.

No confirmed findings remain.

Files Needing Attention: None.

T-Rex T-Rex Logs

What T-Rex did

  • I ran the two focused game date-rendering test files with the America/Chicago configuration and observed two date assertions fail because the dates rendered one day early.
  • I updated the tests to use the timezone loading change, then reran the same files and all six tests passed with the UTC calendar dates rendering as expected.
  • This confirms the timezone assignment is loaded before the affected test suites execute.
  • I reviewed the Timezone validation script artifact to verify the mechanism that ensures the timezone is loaded prior to tests.
  • I inspected the parent and UTC configuration test output artifacts to verify the test results and the URLs where results are available.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "Pin vitest timezone to UTC for determini..." | Re-trigger Greptile

GameRecap and PredictionCard format timestamps with toLocaleDateString in
local time, and their fixtures use early-UTC timestamps that roll back a
calendar day in US zones, so both tests failed on a Mac in a US timezone.
Set process.env.TZ = 'UTC' in vitest.config.ts so every date-rendering
test produces the same day on every machine.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
v0-production-data-application Ready Ready Preview, v0 Sep 4, 2026 2:27pm UTC

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T14:27:37.212213Z 50a34a5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@rstover-fo
rstover-fo merged commit 18c2b33 into main Sep 4, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 50a34a5f Deployed Sep 4, 2026 by vercel[bot]
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.

1 participant