-
Notifications
You must be signed in to change notification settings - Fork 1
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
export-all conflicts with istanbul #5
Comments
please expand on the problem. give an example |
I understand only partially what you're experiencing
Footnotes:
|
Okay, so it went a bit deeper than I thought...
This can help sometimes when you don't need the hoisting mock behavior, but sometimes you need hoisting (you import tested module and it imports a mocked dependency). Cool thing is that jest allows to have vars prefixed with
This works, but only for files in the test folder. Files in
This exception we have only for linter rules, remember? For babel plugin, I don't think we should do this, because you never know if the state of AST tree and BUT... I was wrong when stated the problem in the title. The original problem (95% of all errors) is with coverage plugin Istanbul and that it ruins the AST somehow. I checked the code and they don't appear to be doing anything wrong, but somehow when the execution comes to our plugin, the tree is not correct and this causes same error as here istanbuljs/babel-plugin-istanbul#116. Instead of fixing a bug here, people actually suggest disabling faulting plugin in test env. Sad. I really-really don't want to spend any more time on this problem, even though it's so fun to dig in jest/babel/istanbul 😂 Let's sit in the office when we are both in good health after sickness and decide something. |
🖖 i definitely don't want anyone to spend time like this We settle it tmrw, even if we have a remote session |
I have now read your comment in peace. Let's just say bye-bye to this coverage crap, I say, but we talk tmrw. |
closing as it's a istanbul coverage issue |
Jest mocks do not allow accessing vars from the outer scope, which
exports
is. Also, other weird errors occur, which I don't really want to dig into. Already wasted too much time on this...One of the most simple and clean solutions IMO is to use different
env
s for dev and test in.babelrc
. I managed to get it working pretty easy, since jest setsNODE_ENV=test
and this one is used by Babel to pick config. We have this variable in our makefile, but it's not exported, so gets redefined by jest. Another level of control is to useBABEL_ENV
variable, which has higher priority.Let's discuss in the office how we want to tweak these vars to make it work properly.
The text was updated successfully, but these errors were encountered: