Repository navigation
test: keep the client suite independent of the host locale - #280
Conversation
f9b3651 to
a7a14ea
Compare
|
Rebased onto 3.0.1 ( |
a7a14ea to
1f72616
Compare
Two client test files assert English output from code that formats in the host's default locale, which is right for the app but fails the suite on a developer machine set to another language. The two files on 3.1.0: LC_ALL=fr_FR.UTF-8 3 failed LC_ALL=de_DE.UTF-8 4 failed LC_ALL= (empty) 2 failed Intl resolves `und` LC_ALL=en_US.UTF-8 0 failed - SessionPicker: `relativeTime` uses `Intl.RelativeTimeFormat(undefined, ...)` and its tests match /day/, /second/. Under fr_FR two days ago is 'avant-hier', under de_DE 'vorgestern', under `und` '-2 d'. The function already takes `now` so its tests are deterministic; it now takes an optional `locale` for the same reason, and the tests pass 'en'. The app passes none. - ContextMeter: the context and session titles use `toLocaleString()`, and the tests expected '50,000 of 200,000' and '12,500 tokens · 12,000 input'. Under de_DE those are '50.000' and '12.500'; under fr_FR the groups are separated by U+202F. The expected text is now built with `toLocaleString()`, as AnnotationMarker's and StatusDot's tests already do. With both, `npm run test:client` passes 1150/1150 under fr_FR, de_DE and an empty LC_ALL.
1f72616 to
86ffb22
Compare
|
Rebased onto 3.1.0 ( |
|
✅ Ready to merge – no blocking issues at Automated review pass (Claude Code). |
|
Thanks a lot @miadisabelle – nice catch on the locale-dependent tests, merging! 🙏 |
Two client test files assert English output from code that formats in the host's default locale — correct for the app, but it fails the suite on a developer machine set to another language.
The two files on 3.1.0:
LC_ALLfr_FR.UTF-8de_DE.UTF-8und)en_US.UTF-8SessionPicker
relativeTimeformats withIntl.RelativeTimeFormat(undefined, …)and its tests match/day/and/second/. Two days ago is'avant-hier'under fr_FR,'vorgestern'under de_DE, and'-2 d'underund.The function already takes
nowso its tests are deterministic. It now takes an optionallocalefor the same reason, and the tests pass'en'. The call site passes nothing, so the app still formats in the user's locale.ContextMeter
The context and session titles use
toLocaleString(), and the tests expected'50,000 of 200,000'and'12,500 tokens · 12,000 input'—'50.000'under de_DE, U+202F-grouped under fr_FR. The expected text is now built withtoLocaleString(), asAnnotationMarker's andStatusDot's tests already do.With both,
npm run test:clientpasses 1150/1150 under fr_FR, de_DE and an emptyLC_ALL.If you'd prefer one line instead, setting
test.env.LC_ALLinvitest.client.config.tsalso works, since the forks pool starts its workers with that environment — but it pins every client test to English and depends on the pool staying process-based, so I went with fixing the tests.typecheck,lintandformat:checkpass.🤖 Generated with Claude Code