Repository navigation
Commit b1d2d58
committed
test(webview): await the on-demand locale fetch instead of timing it
The windows-latest platform-unit-test lane failed in this PR's webview-ui
step, with ubuntu cancelled as collateral (job 126169197675). The failing
case is src/i18n/__tests__/TranslationContext.locale-loading.spec.tsx,
which arrived with upstream f8aa881 ("load locales on demand instead of
eager-globbing all 18", upstream #2267) and is byte-identical here to the
copy in the vps2 f-series branches that hit the same red.
The assertion is the problem, not the locale loading. Since #2267 a switch
to a non-fallback language is an import() of that locale's namespace
bundles, so its duration is a property of the machine and of the load on
it; the spec asserted that it lands inside testing-library's fixed
1000 ms waitFor window. Ubuntu finished inside the window and windows did
not, and the received DOM still showed the pre-switch language - the fetch
had not resolved yet, which rules out path separators, a case-insensitive
filesystem or CRLF as the cause.
Each cold-locale assertion now awaits the memoized loadLanguage promise
the provider itself waits on, so the assertion is a statement about
ordering rather than about the clock. waitFor still covers the render that
languageChanged triggers, which is microtask-bound; the unmount case in
this file already awaited that promise.
Controls, run in this worktree on Windows with a harness that delays every
lazy locale module:
- 1500 ms: the previous spec fails 4 of 6 at lines 51, 71, 88 and 127 -
the four waitFor sites - with CI's texts ("Something went wrong"
received for ko/ja/de, "Etwas ist schiefgelaufen" received for fr, which
is the pair this PR's job reported); this spec passes 6 of 6.
- 3000 ms with CI=true (maxWorkers 1, testTimeout 15000): 6 of 6.
- harness reverted byte-identically: 6 of 6 in 1.66s, and webview-ui
tsc --noEmit, eslint --max-warnings=0 --no-warn-ignored and
prettier --check are all clean.
Test-only change: +22 lines, no skip, no suppression. The flaky assertion
is upstream's own, so the same patch should be ported upstream; recorded
on easonLiangWorldedtech#35 for the maintainers.1 parent 36b9e5b commit b1d2d58
1 file changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
| |||
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
87 | 102 | | |
88 | 103 | | |
89 | 104 | | |
| |||
105 | 120 | | |
106 | 121 | | |
107 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| |||
123 | 141 | | |
124 | 142 | | |
125 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
126 | 148 | | |
127 | 149 | | |
128 | 150 | | |
| |||
0 commit comments