Repository navigation
Commit 6129d80
test(tui): pin the runner locale and the update host so the suite is machine-independent (#137)
* test(vitest): pin the runner locale to the one CI uses
The TUI resolves its language from the environment: sessionMutationLocale()
falls back to Intl's resolved locale, which Node derives from LANG, and
packages/tui/src/update/messages.ts reads LC_ALL/LC_MESSAGES/LANG directly.
A developer shell running LANG=zh_CN.utf8 therefore renders Chinese copy
while the suites assert the English strings they ship, and 29 capability
tests fail on a host CI never exercises.
Spawn the suite with LC_ALL and LANG set to en_US.UTF-8 so every group runs
under one locale. Pinning the two variables together covers the Intl and the
environment lookup paths, which stubbing each test would miss. Fixing it in
the runner keeps the suites aligned with CI instead of teaching every
translation-sensitive assertion about the developer's shell.
Purely test infrastructure; no product behaviour changes.
* test(tui): pin the update-service host to a published release target
McodeUpdateService.check() calls resolveMcodeReleaseTarget() with no override,
so it reads process.platform and process.arch. release.ts publishes only
darwin-arm64, darwin-x64, linux-x64, windows-x64 and windows-arm64, and a
host outside that set — linux-arm64, for example — fails every check with
"Unsupported MCode update host" regardless of what the test asserts.
Pin both properties with Object.defineProperty in beforeEach and restore the
captured host descriptors in afterEach, so the rest of the process is
untouched. The fallback is linux-x64, a real REQUIRED_V1_TARGETS entry, so the
tests keep exercising a shipped target instead of an invented one.
Hosts that already publish keep their own platform and arch, which leaves the
win32-only install test on Windows driving the real win32 branch of
resolveMcodeInstallRoot and detectMcodeInstallSource.
Purely test infrastructure; release.ts TARGETS is unchanged, so whether
linux-arm64 should become a published target stays a product decision.
---------
Co-authored-by: s39-dev <s39-dev@local>1 parent c1b239d commit 6129d80
2 files changed
Lines changed: 49 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
59 | 96 | | |
60 | 97 | | |
61 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
19 | 29 | | |
20 | 30 | | |
21 | 31 | | |
| |||
0 commit comments