Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected behavior: expect(() => { throw undefined }).toThrow('Input validation failed') should fail. #7260

Open
6 tasks done
unnoq opened this issue Jan 16, 2025 · 1 comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) upstream

Comments

@unnoq
Copy link

unnoq commented Jan 16, 2025

Describe the bug

Encountered unexpected behavior where throwing undefined still passed the tests. This occurred because I created a mock function meant to check the error before throwing, but I forgot to implement the check.

Expected behavior: expect(() => { throw undefined }).toThrow('Input validation failed') should fail.

Reproduction

Expected behavior: expect(() => { throw undefined }).toThrow('Input validation failed') should fail.

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    Memory: 2.06 GB / 7.57 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.15.2 - ~/.nvm/versions/node/v22.12.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.264
  npmPackages:
    @vitest/coverage-v8: ^2.1.1 => 2.1.8 
    vitest: ^2.1.8 => 2.1.8

Used Package Manager

pnpm

Validations

@sheremet-va sheremet-va added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jan 16, 2025
@hi-ogawa
Copy link
Contributor

Reading #5228 and chaijs/chai#1609, it looks like throw undefined is intended to be supposed by chai, so maybe it's worth reporting upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) upstream
Projects
None yet
Development

No branches or pull requests

3 participants