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
babel 7 inconsistent transformation #7021
Comments
I have the same issue |
Try using Also, what is the output of |
running |
|
yes I use yarn but same error |
In yarn it's |
now I get this instead of empty yarn why v1.7.0 |
Faced exactly the same jest behaviour. Using pure babel-jest or calling createTramsformer with custom config. 20% of tests passed fine while others got undefined options argument in createTransformer. |
I think the problem is that https://github.com/facebook/jest/blob/master/packages/babel-jest/src/index.js#L58 while babel js started to promote a config API which allows to return a function: https://babeljs.io/docs/en/config-files#config-function-api and this is what we have in the example repo project: https://github.com/chrisblossom/backtrack/blob/babel-7/.babelrc.js |
You 9and
…On Tue, Oct 16, 2018, 1:20 AM Michał Rączka ***@***.***> wrote:
I think the problem is that babel-jest expects babel configuration file
babel.config.js to simply return a JS object:
https://github.com/facebook/jest/blob/master/packages/babel-jest/src/index.js#L58
while babel js started to promote a config API which allows to return a
function:
https://babeljs.io/docs/en/config-files#config-function-api
and this is what we have in the example repo project:
https://github.com/chrisblossom/backtrack/blob/babel-7/.babelrc.js
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7021 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AZUzB9euVR-AG7jJmhPoeWSLmuoEmoC0ks5ulZbYgaJpZM4W013K>
.
|
I "fixed" this on my end. In that, I deleted a bunch of stuff that I didn't see a need for -- likely due to my own ignorance. Of course, a proper fix would be nice, but this has worked fine for me so far. Essentially, hand over Babel's config resolution to Babel and don't try to manually resolve it on Jest's end. https://github.com/jahed/jest/commit/42075095732f35a5c02a3eb1c36df671a4eb0071 |
I've found a better temporary solution to this problem. Install babel-core bridge. Instructions here: |
Has anyone found a fix for this? I still am unable to get jest to work with babel 7. I've tried using
|
@chrisblossom if you change the way how the module is being required here https://github.com/chrisblossom/backtrack/blob/697617c7f499c2c8e4c0dd2b7056c1d070a10fcf/src/stats-file/load-stats-file.test.js#L5 const loadStatsFile = () => require('./load-stats-file').loadStatsFile(); to const loadStatsFile = require('./load-stats-file').loadStatsFile; and run that test Seems like something weird is going on with lazy require... |
@airato thanks for the reply! Interestingly enough I just came to the same conclusion trying to move to Typescript. I use the lazy require in combination with |
Closing this in favor of #7438. |
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. |
🐛 Bug Report
When upgrading to
babel 7
some files are not being transformed. I have bothbabel-core@7.0.0-bridge.0
andbabel-jest
installed.Example error message:
To Reproduce
https://github.com/chrisblossom/backtrack/tree/babel-7
jest --clearCache
sometimes helps some tests pass.Expected behavior
All tests pass.
Link to repl or repo (highly encouraged)
https://github.com/chrisblossom/backtrack/tree/babel-7
chrisblossom/backtrack@697617c
Run
npx envinfo --preset jest
The text was updated successfully, but these errors were encountered: