Files
PaperClipAI/ui/vitest.config.ts
T
TonioandClaude Opus 5 add65ba4a2 test(ui): make the suite pass outside UTC (#11480)
The ui suite was green in CI and red on a clean checkout in any other
timezone. GitHub's runners default to UTC, so nothing ever reported it. A
contributor elsewhere sees two failures on their first run, which reads as
"this project is broken" rather than "your clock differs from the runner's".

Two independent causes.

`IssueProperties` supplies a UTC instant and asserts on the local-time string
the UI renders from it - "2026-07-17T16:08:00.000Z" is expected to read
"Today, 4:08 PM". That holds only where local time is UTC. Pinned with
`env: { TZ: "UTC" }` rather than rewritten: those assertions are about what a
person sees, and "4:08 PM" is worth more to a reader than an expectation
computed from the same formatter the component uses, which would pass whatever
that formatter did.

`StatusCards/format` was wrong in two ways at once, and the pin hides only one,
so it is fixed directly. `rollupUpdatesToday` filters on the *UTC* day
boundary, while the test built fixtures from local noon on the real clock.
East of UTC+12, "today at local noon" is already yesterday in UTC and the rows
the test means to count are filtered out; and any run crossing midnight UTC
lands `iso(0)` and the function's default `now` on different days. The
fixtures now come from a fixed instant, passed as `now` - the parameter exists
for this, and the sibling test already used it.

Each fix was confirmed load-bearing by removing it under TZ=Pacific/Auckland.
Without the pin, IssueProperties fails; without the fixed instant, StatusCards
fails even with the pin removed, so neither rides on the other.

Full ui suite 4017 pass, 0 fail, in UTC, Pacific/Auckland and Asia/Kolkata.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 10:15:38 -07:00

25 lines
910 B
TypeScript

import path from "path";
import { defineConfig } from "vitest/config";
export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
lexical: path.resolve(__dirname, "./node_modules/lexical/dist/Lexical.mjs"),
},
},
test: {
environment: "node",
setupFiles: ["./vitest.setup.ts"],
// Pin the clock's timezone so date rendering is the same everywhere.
//
// Several suites supply a UTC instant and assert on the local-time string
// the UI renders from it — "2026-07-17T16:08:00.000Z" is expected to read
// "Today, 4:08 PM". That only holds where local time is UTC. CI passes
// because GitHub's runners happen to default to UTC; a contributor in any
// other zone sees those tests fail on a clean checkout, which reads as
// "the suite is broken" rather than "your clock differs".
env: { TZ: "UTC" },
},
});