Categories
Mastering Development

Jest test can’t import file

I am start test component React with Jest and Enzyme, so I can’t run test success with issue import file. ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import ‘./_rollupPluginBabelHelpers-3c58f0e3.js’; SyntaxError: Cannot use import statement outside a module at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17) at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25) at node_modules/react-imask/dist/react-imask.js:2:83 at Object.<anonymous> (node_modules/react-imask/dist/react-imask.js:5:2) My package.json { "name": "my-app", "version": "0.1.0", "jest": { "testResultsProcessor": "./node_modules/jest-junit-reporter", "transformIgnorePatterns": "[‘node_modules/(?!(imask)/)’]" }, […]

Categories
Mastering Development

react jest babel config : Support for the experimental syntax ‘jsx’ isn’t currently enabled

I am trying to make unit tests with Jest for my reactJs project. When I want to test the rendering of a component, I am getting the following error : SyntaxError: /Users/jk/EpitechProjects/T-WEB-700/CountOfMoney_18/front/src/tests/components/Navbar.test.js: Support for the experimental syntax ‘jsx’ isn’t currently enabled (9:29): 7 | 8 | test(‘Navbar : should render navbar’, ()=>{ > 9 | […]

Categories
Mastering Development

.eslintrc.js file being ignored with create react app and craco

This has been working great for the last couple of years, but we just upgraded a slew of libraries and now eslint, when we run our app, is not referring to our eslintrc file. It’s throwing errors for rules that we have either disabled or set to warning. I can type junk into the eslintrc […]

Categories
Mastering Development

Published npm package does not apply styles

I’m currently working on creating an npm package. Which is basically a React component with added styles using SCSS. When I test it out, the class names are there, but no styles are being applied. Here is the repo for the package. I use a separated webpack config for building the specific folder where the […]