Repository navigation
test: load ICU data once before Vitest workers start - #2226
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to This change affects test startup, not production behavior; no actionable merge-blocking issue is identified. Pre-merge checks |
|
Deploying quickadd with
|
| Latest commit: |
e44bee7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4ee98f6.quickadd.pages.dev |
| Branch Preview URL: | https://fix-windows-filesuggester-ti.quickadd.pages.dev |
|
Ship verification: PASS+NOTES Independent verification of this PR from fresh detached worktrees, not the author's checkout.
Checks run and results:
Root-cause judgment: supported. The failing test is synchronous, and Vitest cannot interrupt a synchronous body, so the 13.4 s and 5.9 s are real wall time inside a body that only builds a few DOM nodes and formats one date. The probes show that first format is I/O-bound on a cold Windows runner and that every later process gets it for about 20 ms once the parent has touched the pages. The fix pays that cost once in the main process before workers start, which is the right place given that two other test files also format dates. Notes, none blocking:
Release impact: none, test infrastructure only, bundles unchanged. |
Independent verification: PASS+NOTESHead
Notes
|
Summary
Platform Test (windows-latest) failed on the last two master pushes. Both times,
renders tooltip metadata as textinfileSuggester.test.tstimed out at 5 s (13,446 ms after #2224 and 5,934 ms after #2225). #2224 did not cause it. In the 20 Windows runs before #2224, the same test took 4,308 ms once and 609 to 1,994 ms in five others.The test made the run's first date format, through
toLocaleDateString()increateTooltip. Node on Windows embeds its ICU data innode.exe, and the first date format on a runner reads those pages from disk. Vitest runs large test files first, so this file starts while every worker loads jsdom, and the read competes for the disk. A Windows probe measured that first call at 689 ms of wall time for 62 ms of CPU. Later processes share the pages, so only the first one waits.The fix formats one date in a Vitest
globalSetup. It runs in the main process before any worker starts.Changes
tests/vitest-global-setup.ts, which formats one date.globalSetupinvitest.config.mts.Production code is unchanged, because ICU is already loaded in Obsidian. A
beforeAllin this one test file was rejected: the wait falls on whichever file formats a date first, and two other test files format dates. A larger test timeout was rejected because it hides the stall.Testing / validation
fileSuggester.test.tstakes 817 ms for 24 tests, and the tooltip test stays under the 300 ms slow-test threshold.pnpm run testpasses (7,019 passed, 28 skipped). Oxlint andtscpass.Release impact: none. The change is test setup only, and
test:requests no release.Checklist