-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
https://jestjs.io/docs/en/mock-functions.html does not document ES6 imports. #10021
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
Comments
Wanna send a PR for it? |
If I knew how it worked, maybe. |
@alexanderkjeldaas there's a related comment here, but also I just filed a related issue here It's possible that the "correct" way to do it is different with or without Babel. Ideally I don't think it should be to avoid confusion. Agree this should be documented after this is all working properly. Hopefully there are some test cases that could just be pasted into the docs as simple examples? |
I can do this:
But this doesn't work for me:
So whether this is indeed a limitation, or maybe I have configured something wrong? It would be good if the docs said something on this topic. |
Started working on this issue but not sure what is needed. There is already a section on ES6 class mocks. Are the examples @alexanderkjeldaas provided enough? Both examples worked fine when I tested them. |
If both should work, then I guess at least giving one example that should work would help, because then the user would at least suspect that it's something wrong in their setup instead of thinking that the ES6 syntax or mocking they are doing is wrong. |
if no one else works on it, I would like to give it a try as my first issue. :) |
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. |
There is no information on how to submit documentation bugs, so I assume it is classified as a bug.
🐛 Bug Report
The "mocking functions" page at https://jestjs.io/docs/en/mock-functions.html
does not document an example using ES6 imports like this:
To Reproduce
Goto https://jestjs.io/docs/en/mock-functions.html
Expected behavior
Documentation on how to mock a function using ES6 import syntax.
Link to repl or repo (highly encouraged)
envinfo
The text was updated successfully, but these errors were encountered: