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.

Error on running jest tests

See original GitHub issue
 /Users/user/dir/node_modules/static-container/StaticContainer.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React, { Component, Children, PropTypes } from 'react';
                                                                                             ^^^^^^
    SyntaxError: Unexpected token import

      at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:320:12)
      at Object.<anonymous> (node_modules/react-native-root-siblings/lib/AppRegistryInjection.js:3:22)
      at Object.<anonymous> (node_modules/react-native-root-siblings/lib/SiblingsManager.js:3:27)

I find this error to be invoked by using package react-native-root-siblings which in new release is using static-container package which is not transformed with babel.

Quick fix is to install older version of package npm install react-native-root-siblings@1.1.0

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

9reactions
stonexercommented, May 5, 2017

you could use this as a work around too

"jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/?!(react-native-root-siblings)"
    ]
}
6reactions
dongyuweicommented, Nov 22, 2017

ignore react-native-root-siblings didn’t work for me, but ignore static-container works.

"jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!static-container)"
    ]
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve jest error when attempting to run test suite?
Issue resolved. Issue was caused by running the tests by using the "jest" command in the terminal which is different from using the...
Read more >
Troubleshooting - Jest
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​.
Read more >
JEST tests complete successfully but returns exit status 1 #9324
I'm running into same issue, test passess successfully but jest returns status code 1 and npm errors. PASS src/test/restart.test.ts √ restart ( ...
Read more >
Running All Tests in Jest doesn't show the error message ...
I have a React / Spring Boot project where I have written several tests in Jest. I have one test where I have...
Read more >
Validation Error when running jest command within node child ...
Validation Error : Jul 2 09:49:39 AM Jul 2 09:49:39 AM Module <rootDir>/test/setup.ts in the setupFilesAfterEnv option was not found.
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