You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@testing-library/user-event tests that drive a debounced component under real timers have become extremely slow, to the point of exceeding a 60s per-test limit. The current mitigation is a global testTimeout: 60000 in jest.config.ts (line 67), which hides the problem rather than fixing it — and the margin is now thin enough that unrelated PRs fail intermittently.
How this was found
While processing Dependabot PRs #2072 and #2073, both went red on Jest shards 5 and 6 with 60s timeouts (not assertion failures) in the SearchPicker / HouseholdItemPicker suites.
react-i18next 17.0.13 has zero runtime JS changes vs 17.0.12 (registry tarball diff: only index.d.ts + changelog).
i18next 26.4.2's sole runtime change is a one-line $-escape in nest(), unreachable here (no $t( nesting anywhere in client/src/i18n/**).
Root cause
The regression entered beta in 038a9431 (PR #2070, "dev-dependencies group across 1 directory with 20 updates"), which bumped:
@testing-library/user-event 14.6.1 → 14.6.7
@testing-library/react 16.3.2 → 16.3.3
jest 30.4.2 → 30.5.1
jest-environment-jsdom 30.4.1 → 30.5.1
That commit's own message records the symptom and the workaround: "SearchPicker-family test timing (global testTimeout raise + a real assertion-ordering race fix)". #2070 passed CI; every PR branched from it has been failing.
Measured impact (from CI, untreated baseline on #2072)
Suite
Wall time
Failing tests
SearchPicker.test.tsx
2377 s (~40 min)
10
HouseholdItemPicker.test.tsx
498 s
2
HouseholdItemPicker.breadcrumb.test.tsx
537 s
2
Note HouseholdItemPicker.test.tsx spends ~357s across its passing tests (~30s each) — the whole file is slow, not just the tests that trip the ceiling.
Three commits convert those suites to jest.useFakeTimers() + userEvent.setup({ advanceTimers: jest.advanceTimersByTime.bind(jest) }), hoisted into each describe's beforeEach, with act(() => jest.advanceTimersByTime(300)) after each type/clear to clear the 300 ms useDebouncedCallback. No assertions were changed and no timeouts were raised. This also uncovered a latent bug: the Floating UI portal (#1708) describe block had nojest.useRealTimers() cleanup.
Remaining work
Sweep the rest of the client suite. There are 587 bare userEvent.setup() occurrences across client/src/**/*.test.tsx, and only 14 files currently use advanceTimers. Any suite combining a bare setup with a debounced component has the same latent slowness, currently hidden by the 60s ceiling. Largest concentrations:
Lower testTimeout back down (jest.config.ts:67) once the sweep lands. At 60000 the next suite to regress hides for a full minute per test instead of failing fast — which is exactly how this reached beta unnoticed.
Investigate the upstream cause. Worth confirming whether user-event 14.6.7 or jest/jsdom 30.5.x is responsible, and whether an upstream issue already exists. If the slowdown is a genuine upstream regression, pinning back may be preferable to converting hundreds of tests.
Summary
@testing-library/user-eventtests that drive a debounced component under real timers have become extremely slow, to the point of exceeding a 60s per-test limit. The current mitigation is a globaltestTimeout: 60000injest.config.ts(line 67), which hides the problem rather than fixing it — and the margin is now thin enough that unrelated PRs fail intermittently.How this was found
While processing Dependabot PRs #2072 and #2073, both went red on Jest shards 5 and 6 with 60s timeouts (not assertion failures) in the SearchPicker / HouseholdItemPicker suites.
The dependency bumps were not the cause:
i18next/react-i18next/fastifychange at all — only a lockfile repair plus eslint/stylelint — and it failed the identical tests.react-i18next17.0.13 has zero runtime JS changes vs 17.0.12 (registry tarball diff: onlyindex.d.ts+ changelog).i18next26.4.2's sole runtime change is a one-line$-escape innest(), unreachable here (no$t(nesting anywhere inclient/src/i18n/**).Root cause
The regression entered
betain038a9431(PR #2070, "dev-dependencies group across 1 directory with 20 updates"), which bumped:@testing-library/user-event14.6.1 → 14.6.7@testing-library/react16.3.2 → 16.3.3jest30.4.2 → 30.5.1jest-environment-jsdom30.4.1 → 30.5.1That commit's own message records the symptom and the workaround: "SearchPicker-family test timing (global testTimeout raise + a real assertion-ordering race fix)". #2070 passed CI; every PR branched from it has been failing.
Measured impact (from CI, untreated baseline on #2072)
SearchPicker.test.tsxHouseholdItemPicker.test.tsxHouseholdItemPicker.breadcrumb.test.tsxNote
HouseholdItemPicker.test.tsxspends ~357s across its passing tests (~30s each) — the whole file is slow, not just the tests that trip the ceiling.Already fixed (on PR #2073 only)
Three commits convert those suites to
jest.useFakeTimers()+userEvent.setup({ advanceTimers: jest.advanceTimersByTime.bind(jest) }), hoisted into eachdescribe'sbeforeEach, withact(() => jest.advanceTimersByTime(300))after eachtype/clearto clear the 300 msuseDebouncedCallback. No assertions were changed and no timeouts were raised. This also uncovered a latent bug: theFloating UI portal (#1708)describe block had nojest.useRealTimers()cleanup.Remaining work
Sweep the rest of the client suite. There are 587 bare
userEvent.setup()occurrences acrossclient/src/**/*.test.tsx, and only 14 files currently useadvanceTimers. Any suite combining a bare setup with a debounced component has the same latent slowness, currently hidden by the 60s ceiling. Largest concentrations:client/src/pages/ReportWizardPage/ReportWizardPage.test.tsxclient/src/pages/SubsidyProgramsPage/SubsidyProgramsPage.test.tsxclient/src/pages/BudgetSourcesPage/BudgetSourcesPage.test.tsxclient/src/pages/ManagePage/ManagePage.test.tsxclient/src/pages/VendorDetailPage/VendorDetailPage.test.tsxclient/src/pages/ReportWizardPage/ReportWizardPage.aiGeneration.test.tsxclient/src/pages/HouseholdItemDetailPage/HouseholdItemDetailPage.test.tsxLower
testTimeoutback down (jest.config.ts:67) once the sweep lands. At 60000 the next suite to regress hides for a full minute per test instead of failing fast — which is exactly how this reachedbetaunnoticed.Investigate the upstream cause. Worth confirming whether
user-event14.6.7 orjest/jsdom30.5.x is responsible, and whether an upstream issue already exists. If the slowdown is a genuine upstream regression, pinning back may be preferable to converting hundreds of tests.References
038a9431(PR chore(deps-dev): bump the dev-dependencies group across 1 directory with 20 updates #2070)jest.config.ts:67🤖 Filed by
/dependabot