test: keep the client suite independent of the host locale - #280
Open
miadisabelle wants to merge 1 commit into
Open
miadisabelle wants to merge 1 commit into
miadisabelle wants to merge 1 commit into
Conversation
Two client tests 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. `npm run test:client` on a clean checkout: 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. - AgentChatView: the context and token titles use `toLocaleString()`, and the tests expected '50,000 of 200,000' and '12,500 tokens'. 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 test already does. With both, the client suite passes 803/803 under all four settings above.
miadisabelle
force-pushed
the
contrib/session-picker-locale-test
branch
from
September 19, 2026 09:58
f9b3651 to
a7a14ea
Compare
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.
Two client tests 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.
npm run test:clienton a clean checkout ofmain: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.AgentChatView
The context and token titles use
toLocaleString(), and the tests expected'50,000 of 200,000'and'12,500 tokens'—'50.000'under de_DE, U+202F-grouped under fr_FR. The expected text is now built withtoLocaleString(), asAnnotationMarker's test already does.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 two tests.npm run compile,typecheck,lintpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01SK5d1Qh4JcJVF39HEkFBxX