You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jest/unbound-method currently returns a problem for:
importgetMethodfrom'./get-method'constobj={method: jest.fn(),}it('should get a method',()=>{expect(getMethod(obj)).toBe(obj.method)// problem here: Avoid referencing unbound methods…})
I think it'd make sense to allow passing methods to matchers to check for references in cases where the method isn't being called.
The text was updated successfully, but these errors were encountered:
G-Rath
changed the title
Allow passing unbound methods to matchers when method isn't called
[unbound-method] Allow passing unbound methods to matchers when method isn't called
Dec 19, 2021
The problem is there's no way for us to know if a general matcher will call that argument or not - we could ship a list of all Jest matchers to at least special case them, but I'm a bit reluctant to do that as it would make us less consistent with the base rule (since that has the same issue).
We could do it for just a few of the matchers (like the equality ones) but I feel like this isn't a common enough pattern to be worth the inconsistency.
jest/unbound-method
currently returns a problem for:I think it'd make sense to allow passing methods to matchers to check for references in cases where the method isn't being called.
The text was updated successfully, but these errors were encountered: