-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
@swc/jest does not support jest mocking of exported functions within same module #4455
Comments
Closing as duplicate. Please search first |
I guess you are referring to #4104? It is not always easy to find a matching issue within roughly 300 issues. And actually I don't agree that this is the same issue. |
I meant #3843 |
Thanks for sharing. Wasn't looking into the resolved issues. To summarize here again: This is expected behavior of swc and some other code transformers are wrong. In order to fix it, stuff that needs to be mocked should be moved into separate modules. |
I don't think all other are wrong. I didn't say such sentence |
Ok. Sorry. I updated my comment to "some". But maybe I didn't fully get this one: And thanks for being so responsive. Made me consider to migrate our code base to swc instead of surcrase. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the feature
Running this:
Produces the following output:
But then the following test code would not work:
When comparing the produced output to other Transformers, e.g. the following:
We get this output:
Therefore I would suggest to change the implementation to use the
exports
object also when using exported functions inside other functions. E.g. the output fixing the above test should become:Babel plugin or link to the feature description
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: