vitest-dev / vitest-dev/vitest
Chai API is broken after `Promisify` (`resolves`/`rejects`)
Open
Nobody has claimed this yet.
p2-to-be-discussed
pending triage
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 92
Description
Describe the bug
Chai API that does not contain function (e.g., to.be.empty) is broken after Promisify (resolves/rejects) in runtime. Instead of successfully passing, it says:
Promise returned by `expect(actual).resolves.assert(expected)` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
Reproduction
This is a small example of the issue.
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 12.62 GB / 23.33 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 22.14.0 - ~/.volta/tools/image/node/22.14.0/bin/node
Yarn: 1.22.22 - ~/.volta/bin/yarn
npm: 10.9.2 - ~/.volta/tools/image/node/22.14.0/bin/npm
pnpm: 10.4.1 - ~/.volta/bin/pnpm
Browsers:
Chrome: 131.0.6778.85
npmPackages:
@vitejs/plugin-react: 4.3.4 => 4.3.4
@vitest/browser: 3.0.4 => 3.0.5
@vitest/coverage-v8: 3.0.4 => 3.0.5
@vitest/ui: 3.0.4 => 3.0.5
playwright: 1.50.0 => 1.50.1
vite: 6.0.11 => 6.1.0
vitest: 3.0.4 => 3.0.5
Used Package Manager
npm
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
Start with the reproduced test in test/basic.test.ts and trace the runtime handling of Chai assertions after resolves/rejects promisification. Reproduce the empty or other non-function assertion and verify that it passes without the unawaited-promise warning, while awaited assertions continue to behave correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100