Skip to content
New issue

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

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

Already on GitHub? # to your account

[unbound-method]: don't report unbound methods passed to jest.mocked #1596

Closed
FloEdelmann opened this issue May 29, 2024 · 1 comment · Fixed by #1681
Closed

[unbound-method]: don't report unbound methods passed to jest.mocked #1596

FloEdelmann opened this issue May 29, 2024 · 1 comment · Fixed by #1681

Comments

@FloEdelmann
Copy link
Contributor

import foo from './foo'

jest.mock('./foo')

jest.mocked(foo.bar).mockResolvedValue(baz)
//          ^^^^^^^ jest/unbound-method reports an error here

expect(foo.bar).toHaveBeenCalled() // no error here

Since jest.mocked will be called with mock functions, it should not make a difference whether it is bound or not, right? So I'd suggest to not report an error for unbound methods passed to jest.mocked, just like already happens when passing it to expect.

Copy link

🎉 This issue has been resolved in version 28.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants