vitest-dev / vitest-dev/vitest

expect.poll.timeout not being respected

Open
#8,308 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feat: browser pending triage
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

Am using Vitest browser with Playwright runner, and rendering Svelte components. In vite.config.js, I have test.expect.poll.timeout set to 500ms and test.testTimeout set to 5000ms (5s).

When awaiting expect.element on a locator that doesn't match anything, instead of timing out within 500ms, it takes the full 5s to timeout.

I don't want to decrease test.testTimeout value because some tests take 1-2 seconds. Should test.expect.poll.timeout be working in this instance? Or am I misunderstanding how it operates?

Reproduction

vitest-issue-8308.zip

Download, extract, yarn, then yarn test results in timeout after 5s, not 500ms

System Info
System:
    OS: macOS 15.5
    CPU: (14) arm64 Apple M4 Pro
    Memory: 168.45 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.15.1 - ~/.asdf/installs/nodejs/22.15.1/bin/node
    Yarn: 4.9.2 - ~/.asdf/installs/nodejs/22.15.1/bin/yarn
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Brave Browser: 138.1.80.120
    Chrome: 138.0.7204.101
    Safari: 18.5
  npmPackages:
    @vitest/browser: ^3.2.4 => 3.2.4 
    @vitest/ui: ^3.2.4 => 3.2.4 
    playwright: ^1.54.1 => 1.54.1 
    vite: ^7.0.4 => 7.0.4 
    vitest: ^3.2.4 => 3.2.4 
    vitest-browser-svelte: ^1.0.0 => 1.0.
Used Package Manager

yarn

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Extract the linked vitest-issue-8308.zip reproduction, install its dependencies with yarn, and run yarn test. Start by inspecting vite.config.js and the browser test that uses expect.element; done means the missing locator times out according to expect.poll.timeout rather than the full test.testTimeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, playwright
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.