vitest-dev / vitest-dev/vitest
expect.poll.timeout not being respected
Nobody has claimed this yet.
- 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
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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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