-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 with dynamic requires does not work #7438
Comments
You also need to install |
You have to add an custom transformer to solve this Babel 7 issues... I have added a Pull request to your repository wich solves it |
@thymikee adding |
We use babel itself to lookup config in Jest 24, so this has been solved on master. Install |
@SimenB |
That's what I get for not actually testing 😅 First of all, you also need to update diff --git i/package.json w/package.json
index e61a4c6..978b95b 100644
--- i/package.json
+++ w/package.json
@@ -12,8 +12,7 @@
"devDependencies": {
"@babel/core": "7.2.2",
"@babel/preset-env": "7.2.3",
- "babel-core": "7.0.0-bridge.0",
- "babel-jest": "23.6.0",
+ "babel-jest": "24.0.0-alpha.9",
"jest": "24.0.0-alpha.9"
}
} However, that does not solve your issue. The issue is due to the fact you do (A case might be made that Jest should not give you access to the real A potential solution (other than the PR you received) is to tell babel to use Another thing that fixes it is setting @loganfsmyth do you think Jest should be setting Note that we have a PR allowing you to configure the transformer (#7288) which should be slightly less chunky than having to call |
Babel accepts a |
Ah, that makes more sense, yeah 🙂 However, |
Oh I should have clarified, my suggestion was to call |
Right! Yeah, we can do that. |
@SimenB Thanks for reopening the issue and looking further into it.
I'd personally vote against this. I use I don't mind having to use a custom transformer just as long as I can continue to change
This sounds like the best solution to me if it works out of the box. |
See #7574 |
I just wanted to confirm that this issue has been fixed with |
Is alpha.12 before 24.0.0 ? I have upgrade to 24.0.0 and I still have the issue. I am using module.exports = {
only: [
'src',
'styleguide',
],
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
'@babel/preset-react',
],
plugins: [
'babel-plugin-styled-components',
'babel-plugin-array-includes',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-json-strings',
[
'@babel/plugin-proposal-decorators',
{
legacy: true,
},
],
],
env: {
production: {
plugins: [
'add-module-exports',
'@babel/plugin-transform-modules-commonjs',
],
},
test: {
plugins: [
'@babel/plugin-transform-modules-commonjs',
'dynamic-import-node',
],
},
},
}; |
@kopax yeah, 24.0.0 is a stable release made after all the alphas. Could you put together a repository we can pull down that reproduces the issue? |
git clone git@github.com:bootstrap-styled/v4.git
cd v4
git checkout dev-jest24
npm i
npm test There's also a detailled issue on stackoverflow |
Thanks, let's continue in #7765 |
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 using Babel 7, Jest does not transform dynamic required files. Babel 6 works as expected.
This is a continuation of #7021.
Link to repl or repo (highly encouraged)
chrisblossom/jest-issue-7438
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: