Skip to content

test: replace the remaining real-time sleeps in component tests with conditions or a fake clock #568

Closed

Description

@mvilacad

Follow-up of #546. The component suite still has real-time waits that cost wall time on every run and flake under load (the repo's own rule: "a condition is awaited with expect.poll/expect.element, never a fixed setTimeout deadline").

Where (from rg "setTimeout|Bun.sleep|waitForTimeout" packages/ui/src --glob '*.svelte.test.ts', 50 sites, ~8 s of fixed waits after #546 converted Carousel's four)

File Waits What it waits for
VirtualList.svelte.test.ts 100, 100, 900 ms a scroll/prepend to settle: wait on the rendered rows or scrollTop, not a timer
MotionStage.svelte.test.ts 500 x4, 400 ms "nothing moved" after a takeover: a fake clock (as in Carousel), or the cycle counter
DropdownMenu.svelte.test.ts 400, 400 ms a submenu open delay: fake timers or expect.poll
HoverCard, NavigationMenu, Menubar, ContextMenu 60 to 300 ms open/close delays
presence.svelte.test.ts, dnd.svelte.test.ts 60 to 250 ms exit animation / long-press
Turnstile, route-announcer, navigation-progress, Card, PageShell.nomain, Button, SplashScreen, MapStageDeck, CommandPalette.async, Tooltip 30 to 500 ms various

Rule for the conversion

Acceptance

  • No real setTimeout wait left in *.svelte.test.ts except where a comment names why a fake clock cannot work.
  • The full component run (bun run test:browser) is faster by the removed wait time and still green.

Activity

  1. added
    enhancementNew feature or request
    area:teststest infra, flakes, CI
    in progressSomeone is working on it (see the linked draft PR)
    on Oct 25, 2026
  2. self-assigned this
    on Oct 25, 2026
  3. mvilacad commented on Oct 25, 2026

    @mvilacad
    ContributorAuthor

    Working on this in #603 (draft). Branch feat/568-test-replace-the-remaining-real-time. Regression test first, then the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:teststest infra, flakes, CIenhancementNew feature or requestin progressSomeone is working on it (see the linked draft PR)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions