-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Error when using jest + collectCoverage/babel-plugin-lodash #116
Comments
Have you tried moving the {
"plugins": [],
"env": {
"production": {
"plugins": ["lodash"]
}
}
} then when running tests, use:
|
@namjul feels like an order of operation issue related to the order that the plugins are applied; I've seen similar issues with a few other plugins in the past (babel-plugin-rewire comes to mind). It might be worth also opening a tracking issue on |
@AndersDJohnson thats a workable solution thanks. There is probably still a bug somewhere like @bcoe mentioned. |
Incompatibility with Jest coverage istanbuljs/babel-plugin-istanbul#116
Hi, I've been searching the issue trackers of I'm auto-importing all exported functions from
and import it as preset in my
This works fine until I run
Result:
But running
So it looks to me that the import is not generated for whatever reason when the code's unused during the coverage-generating test run. Maybe some kind of intermediate state of "babelified" code is used? Running |
Having the same issue running without coverage works but I would like a solid solution. |
It won't help everyone as there are different test pipelines, but for some odd reason i've found that using |
@cmswalker @BobDeKort is it the lodash plugin giving you both issues as well? Seems like a frequent enough cause of problems that it might be worthwhile trying to get a fix in for this specific incompatibility. |
@bcoe yes. We had to pull istanbul out of our deploy pipleline and stick to using it on the side. Not sure why/how there is an inconsistency with |
@cmswalker @BobDeKort labeled this as high priority, to remind me that this would be a good thing to put some debugging work into. It might also be worthwhile to start a conversation on the |
@bcoe pinged them in: lodash/babel-plugin-lodash#207 |
Looks similar to: |
i'm having incredibly similar issues with react-native-dotenv. |
Ran into this too with babel-plugin-dotenv-import (which is very similar to "coveragePathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/src/utils/env.js"
], |
I posted this issue before on jestjs/jest#3959 and lodash/babel-plugin-lodash#179
Using babel-plugin-lodash, collectCoverage enabled and a lodash function as show below imported from test file, results into an error.
example#testFunction1
npm test
will outputexample#testFunction2
npm test
will outputRemoving
collectCoverage
frompackage.json
lets the tests run without failure.Removing babel-plugin-lodash from .babelrc or importing directly from lodash also runs without failure.
Testcase
https://github.com/namjul/jest-babel-lodash-issue
The text was updated successfully, but these errors were encountered: