-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Labels
Description
Describe the bug
Specifying body: ""
when using annotations reports an error. However, this is a valid case (should annotate an empty string).
This appears to be caused by the simple if (!attachment.body ...)
line here:
vitest/packages/runner/src/context.ts
Line 171 in acbe0e9
if (!attachment.body && !attachment.path) { |
This would be better replaced with:
if (attachment.body == null && !attachment.path) {
throw new TypeError(`Test attachment requires body or path to be set. Both are missing.`)
}
Reproduction
await annotate("Anything", { body: "" })
System Info
System:
OS: macOS 15.6
CPU: (10) arm64 Apple M1 Pro
Memory: 199.09 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.19.0 - ~/.asdf/installs/nodejs/22.19.0/bin/node
Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.19.0/bin/yarn
npm: 10.9.3 - ~/.asdf/installs/nodejs/22.19.0/bin/npm
Browsers:
Chrome: 140.0.7339.213
Edge: 140.0.3485.81
Safari: 18.6
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.