"craco test" does not respect babel plugins
See original GitHub issueHere’s my config:
module.exports = function({ env, paths }) {
return {
babel: {
plugins: [
[
'@babel/plugin-proposal-decorators',
{
// https://babeljs.io/blog/2018/09/17/decorators
// https://github.com/mobxjs/mobx/issues/1352
legacy: true
}
]
]
}
};
};
npm test
(or ./node_modules/.bin/craco test
) results in the following error:
Craco version: 3.2.0 React-Scripts version: 2.1.1
Test file content:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './../App';
import { shallow } from 'enzyme';
const stores = {
};
it('renders without crashing', () => {
const div = document.createElement('div');
shallow(<App {...stores}/>, div);
ReactDOM.unmountComponentAtNode(div);
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
"craco test" does not respect babel plugins · Issue #50 - GitHub
I tried to run the test with a react-mobx observer (as a decorator) using the "@babel/plugin-proposal-decorators" plugin with the legacy ...
Read more >Configuring FBT API with TypeScript and create-react-app.
But in short the Babel plugins will read the code to locate and extract the ... with 'craco' for the scripts 'start', 'build'...
Read more >Why simple babel plugin breaks jest test? - Stack Overflow
I wrote a simple plugin: export default function() { return { visitor: { Program: { enter() { console.log('Program Entered!
Read more >Creating and testing a react package with CRA and rollup
rollup-plugin-visualizer: Visualize and analyze your Rollup bundle to see which modules are taking up space. Run this to install babel and the ...
Read more >less-loader | webpack - JS.ORG
less-loader applies a Less plugin that passes all queries to the webpack resolver if less could not resolve @import . Thus you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I created an example here: https://github.com/stam/craco-test-example Just the basic CRA 2 with craco + mobx
FAIL src/App.test.js ● Test suite failed to run
Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.243s Ran all test suites.
Watch Usage: Press w to show more.
Hey guys
The problem is fixed in version
3.2.1-alpha.0
I am going away for a few days, I will publish it as the latest version when I get back.