fix(frontend): pin the test timezone so date assertions are deterministic - #3897
Merged
Conversation
mlodic
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
frontend/tests/components/chat/ChatSessionList.test.jsxfails on any contributor machine whosetimezone is not UTC. The test feeds a UTC instant and asserts the UTC-rendered string:
while the component renders in local time (
src/components/chat/ChatSessionList.jsx:86):date-fns-tz'sformatuses the runtime timezone, so onEurope/Rome(UTC+2 in June) the row shows2026-06-11 16:02and the lookup fails. CI runs in UTC, which is why this was never caught there.The component's behaviour is correct — analysts want local time. The defect is that the suite does
not pin a timezone, so it silently depends on the machine's own.
Fix
One line in
jest.config.js:It is set at config-module level rather than in
setupFilesAfterEnv, so it is exported to the workerprocesses before their
Dateis initialised — setting it after the environment is installed is toolate to be reliable.
Verification
On a
Europe/Romehost:npx jest tests/components/chat/ChatSessionList.test.jsxfails;TZ=UTC npx jest …passes.TZ=UTCin the environment.(
UserEventModal › advanced fields) reproduces identically without this change, so it ispre-existing and unrelated to the timezone.
No behaviour change: this only affects the test runner's environment.
Refs #3896Type of change
Checklist
developDeepSource/Django Doctorsalerts raised on the PR.