Repository navigation
Use TEST_LOCALES in the tests that rebuilt it by hand - #1118
Conversation
55 test files built "every catalog language but English" themselves, as CATALOG_LOCALES.filter((locale) => locale !== 'en'), in a local OTHER_LANGUAGES or OTHER_LOCALES constant or inline in it.each and describe.each. They now import TEST_LOCALES from src/i18n/testing/locales, the list CLAUDE.md and docs/translating.md name, so a change to what counts as a test language reaches every test. Test-only: the same tests run, under the same names. Fixes #1083. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SSuGiGw15v9XVfXQeL
Tophat: passedWhat changes for people: Nothing. This PR changes tests only, so there was nothing to click through in the app.
Not checked: I didn't re-run the 6 DB test files or the two e2e specs here. CI ran e2e green on this SHA, and the PR reports a Ran 6cac438 against 3ace3e5 locally, no app needed, no data. https://claude.ai/code/session_016YZ9ST5DVxZNyWwie56jbd Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
Every hand-written CATALOG_LOCALES.filter(… !== 'en') now imports TEST_LOCALES, across 53 unit and DB test files and the two e2e specs. The grep finds only the definition and the two non-copies the issue says to keep. Every "Done when" item holds: vitest list on the 47 touched unit files gives the same 877 names on base and head, and they pass. It changes tests only.
Blocking (0)
Optional (1): six tests rebuild OTHER_LOCALE by hand the same way (CATALOG_LOCALES.find(l => l !== 'en') ?? 'en'). That's outside #1083's scope, so it's filed as #1119.
Earlier threads: none
Checks: CI is green on 6cac438 (lint-type-test, e2e, CodeQL). The tophat passed on this SHA, with 0 runtime hunks. Locally, typecheck and lint pass and so do the touched unit tests.
https://claude.ai/code/session_016YZ9ST5DVxZNyWwie56jbd
Generated by Claude Code
Fixes #1083.
Session: https://claude.ai/code/session_016YZ9SSuGiGw15v9XVfXQeL
The problem
TEST_LOCALES(src/i18n/testing/locales.ts) defines a test language: every catalog language but English. But 57 places in 55 test files rebuilt that list themselves asCATALOG_LOCALES.filter((locale) => locale !== 'en'), as a localOTHER_LANGUAGES/OTHER_LOCALESconstant or inline init.each/describe.each. If the definition changed, those copies wouldn't follow it.The fix
TEST_LOCALES. That covers the 28OTHER_LANGUAGESconstants, the 6OTHER_LOCALESconstants, the 21 inline filters and the two e2e specs (organizer-language.spec.ts,organizer-language-story.spec.ts).CATALOG_LOCALEScame out of the imports in files that no longer use it.SignupHeader.test.tsxandUNSHIPPED_LOCALESintests/e2e/helpers/unshipped-locales.ts.Tests
grep -rnE "CATALOG_LOCALES\.filter" src testsnow finds only the definition and the two non-copies.vitest liston the 53 touched unit and DB test files, before and after the change. Both runs list the same 877 tests with identical names.pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(3882 passed, 1 expected fail).pnpm test:dbpassed against local Postgres: 901 tests in the first run. The query-budget file needed theNEXT_PUBLIC_*env fromrun-opensignup, and passed once that was set.Generated by Claude Code