question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestSuites Fail with syntax Error

See original GitHub issue

Version 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:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
tushargargdaffodilcommented, May 21, 2019

Hi @KaiHotz Solution is already mentioned, just add this in the jest.config file:

transformIgnorePatterns: [ ‘node_modules/(?!react-formik-ui/)’ ],

1reaction
iPwnPancakescommented, Jun 6, 2019

For those using react-scripts in CRA, replace the test script line with: "test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!react-formik-ui/)\""

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found