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

Jest rejects.toThrow doesn't work as expected #7631

Closed
dmytrotkk opened this issue Dec 13, 2023 · 0 comments · Fixed by #7652
Closed

Jest rejects.toThrow doesn't work as expected #7631

dmytrotkk opened this issue Dec 13, 2023 · 0 comments · Fixed by #7652
Labels
bug Something isn't working

Comments

@dmytrotkk
Copy link

What version of Bun is running?

1.0.17

What platform is your computer?

Darwin 23.0.0 arm64 arm

What steps can reproduce the bug?

Default example of rejects.toThrow:

https://jestjs.io/docs/expect#rejects

test('rejects to octopus', () => {
  // make sure to add a return statement
  return expect(Promise.reject(new Error('octopus'))).rejects.toThrow(
    'octopus',
  );
});

What is the expected behavior?

Since both rejects and toThrow listed as supported in bun test doc, test example is expected to work
Screenshot 2023-12-13 at 13 58 02

What do you see instead?

Test example fails with error: Expected value must be a function

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant