-
Notifications
You must be signed in to change notification settings - Fork 7
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
Wish: Hoisted Modules #35
Comments
I think your workaround is the only way to address the issue. I don't think I can do anything in the transformation that would prevent the code in the module body from executing. Delaying the execution (by importing the module later) seems like the way to go. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue!
Currently I am in the process of using this to mock out imported dependencies for Cypress Component Testing, it works great but I am trying to get around an issue with IIFE behaviour in one of our files. Eg:
The issue is, because the
withDateString()
method is invoked not on execution of the SUT but on the import, as such its impossible to ever mock that dependency.What I would like!
If there was an option in the plugin setup to hoist mocks above their declaration in the rewritten code so that they can effectively be mocked before import!
Currently my workaround is to do this in my test code, eg:
But would prefer a way that allows me to use Imports as they are and simply mock where I want safe in the knowledge the plugin will ensure order of execution is sorted for me.
The text was updated successfully, but these errors were encountered: