-
Notifications
You must be signed in to change notification settings - Fork 460
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
documentation of babelConfig field is wrong? #1309
Comments
Hi, Your not working example isn't the same as your expectation code. In your not working code, babel file is babelrc.test.js while expectation code is babel.config.js. I've checked on babel doc and I couldn't find babel support for .test.js. Does babel really support .test.js ? If you switch your babel config file to either .babelrc or babel.config.js it should work. Those 2 files are defined in babel doc |
Ah sorry, I just copied the code snippet from https://kulshekhar.github.io/ts-jest/user/config/babelConfig.
The error is
The working code is
I will update the issue description. |
would you please also provide your |
Sure, it's not a crazy one.
|
when I use the code below 'ts-jest': {
babelConfig: require('./babel.config.js')
} I got an error on transform jsx my babel.config.js const utils = require('./build/util');
module.exports = function(api) {
const isTest = api.env('test');
let presets = [];
if (isTest) {
presets = ['@babel/preset-env', '@babel/preset-react'];
} else {
presets = [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
browsers: ['last 2 versions', 'ie >= 11'],
},
modules: false,
useBuiltIns: 'entry',
corejs: 3,
},
],
];
}
const plugins = [
'react-hot-loader/babel',
'@babel/plugin-syntax-dynamic-import',
];
api.cache(true);
return {
presets,
plugins,
};
}; am I using it the wrong way? |
it works when I use the code below babelConfig: true, |
Hi @chasel34, Use I'll check why |
Any updates? I am happy to send a pull request to fix the documentation if that is what you want. |
I confirmed this is indeed an issue. There are 2 issues here:
Does |
close via #1332 |
Thanks for fixing it. |
Thanks for fixing it.😊 |
If others run into this and are using typescript, keep in mind that |
The document says we can use a js babel config file in babelConfig
This doesn't work, it gives me
Expected behavior :
The correct usage is
Shall we update the document accordingly?
The text was updated successfully, but these errors were encountered: