-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
automocking ignores arrow-functions in ES6 classes #6065
Comments
Yep, Jest can only mock the structure of objects that are present at My suggestion to that would be that you change the fat arrow assignments to standard methods and I'm happy to take a PR with some improvements to the documentation, though 🙂 |
thanks @mjesun that's what I was thinking. I'll ship the PR soon. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This is something between a question and feature request:
I was checking out the docs for es6 class mocks. The example uses the following code:
If I create an automock of such module, the
playSomethingCool
function will be mocked. However, if I change it to an arrow function (which I would wanna do because of the behavior ofthis
), the mock won't contain theplaySomethingCool
function. I am aware of the fact that the arrow function is not present on the object's prototype which is probably why the behavior is different.I would like to ask if this is the intended behavior and if it would make sense to create mocks also for the arrow functions. I feel like this is something that should be covered in the docs, which I wanted to do a PR for but I figured I would first ask here.
Thanks
running jest 22.4
The text was updated successfully, but these errors were encountered: