TestSuites Fail with syntax Error
See original GitHub issueVersion The version of React-Formik-UI that you are using : “react-formik-ui”: “^2.3.17”
Mode
The mode you are using React-Formik-UI in,
[Default
]
Describe the bug It is working in Browser, but gives syntax error in TestCases: app/systems/components/react/SystemStartMonitoring.jest.jsx ● Test suite failed to run
/data/frontend/node_modules/react-formik-ui/dist/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React__default, { useState, Fragment, createElement, Component, forwardRef, useEffect, useRef, useReducer, useCallback, useMemo, createRef } from 'react';
^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
3 | import { connect } from 'react-redux'
4 | import { Form, Datepicker } from 'react-formik-ui'
> 5 | import { pick, isEmpty } from 'lodash'
| ^
6 | import { t } from 'ttag'
7 | import { nl } from 'date-fns/locale'
8 | import { Formik } from 'formik'
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:451:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:493:19)
at app/systems/components/react/SystemStartMonitoring.jsx:5:87
at Object.<anonymous> (app/systems/components/react/SystemStartMonitoring.jsx:13:3)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Test suite failed to run Syntax Error: Unexpected identifier
I want to replace Karma with Jest, for some existing unit tests, in my angular project. I managed to have all configured just...
Read more ><project_folder>/node_modules/react-native/Libraries/polyfills ...
I tried to run yarn test on my react-native project, but getting a "Test suite failed to run" error. ○ Test suite failed...
Read more >unittest — Unit testing framework — Python 3.11.1 ...
Third-party unittest framework with a lighter-weight syntax for writing tests. ... Output is echoed normally on test fail or error and is added...
Read more >Automatic tests can succeed with syntax errors - SWI-Prolog
Question: is there an option to swipl that will cause a failure if a file is loaded that has a syntax error? By...
Read more >Why did my test fail? - Testim overview
“Syntax error” - Incorrect JavaScript syntax. The error can be due to code in a custom step or code in a JavaScript parameter....
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 Free
Top 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
Hi @KaiHotz Solution is already mentioned, just add this in the jest.config file:
transformIgnorePatterns: [ ‘node_modules/(?!react-formik-ui/)’ ],
For those using react-scripts in CRA, replace the
test
script line with:"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!react-formik-ui/)\""