Open OZZlE opened 6 days ago
Hello @OZZlE , this library assumes you have a transformer file setup. You are correct that the instructions should be enhanced to help users without such a file. Here is a walk through:
babel-jest
(thus the name babel-jest-boost
). If you take a look at the babel-jest configuration you will see that you need to add a "transform" key to your jest.config.js
https://www.npmjs.com/package/babel-jest
"transform": {
"\\.[jt]sx?$": "babel-jest"
},
This tells jest to use babel-jest
to transpile the javascript.
For instance:
"transform": {
"\\.[jt]sx?$": "<rootDir>/config/jest/babelTransform.js"
}
And the contents of babelTransform.js
can be:
const { jestConfig } = require('@gtsopanoglou/babel-jest-boost/config');
const babelJest = require('babel-jest').default;
module.exports = babelJest.createTransformer({
plugins: [
[
require.resolve('@gtsopanoglou/babel-jest-boost'),
{
jestConfig,
importIgnorePatterns: [
],
},
],
],
babelrc: false,
configFile: false,
});
I will have a look into changing the default export of this plugin such that you can use a simple:
"transform": {
"\\.[jt]sx?$": "babel-jest-boost"
},
However i expect most people to need to add some ignore patterns, so it probably won't be heavily used. It will be a good step towards initial integration though.
Our jest.config.ts:
You seem to STILL be using require for some reason?
I tried this without luck: