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.

Problems testing my app

See original GitHub issue

Hi! i’m having this error while testing my project, it’s caused by the library. I’m kinda a noob with testing so if anyone can help me to fix this that would be great.

` FAIL src/components/navbar/NavBar.test.js ● Test suite failed to run

/Users/bchavez/Documents/km-careerpath/ui/node_modules/react-xarrows/lib/index.js:12
import React, { useRef, useEffect, useState } from "react";
^^^^^^

SyntaxError: Cannot use import statement outside a module

  1 | import React, { useState } from "react";
> 2 | import Xarrow from "react-xarrows";
    | ^
  3 | import "./TreeNode.scss";
  4 |
  5 | function TreeNode(props) {

  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 Object.<anonymous> (src/components/tree-node/TreeNode.js:2:1)`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Eliav2commented, Oct 1, 2020

It was just an issue related to tsconifg file. the target javascript version the ts compiler used was esnext, now, in v1.5.0 the ts files are compiled to javascript version commonjs and now jest should work properly. please update to 1.5.0 and check if the issue still exists.

0reactions
Eliav2commented, Sep 26, 2020

something is unvalid or missing with the typescript/babel/webpack configuration files. @walandemar your answer is just a workaround because the files should’ve already been transformed (means plain javascript files and not typescript files), what you actually do is just transforming ts files to js before testing.

For some reason, it seems that jest is referring to src/index.tsx instead the complied version lib/index.js, I’ve no idea why.

if someone here has some deep knowledge in these settings, please clone the repo, fix, and open a pull request with the fix. I don’t know what causes this and I to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Mobile Testing Challenges and Solutions
5 Mobile Testing Challenges and Solutions · #1) Multitude Mobile Devices · #2) Device Fragmentation & Various OS Platforms · #3) Different Mobile ......
Read more >
10 Challenges in Mobile Application Testing with Solutions
1. Device Fragmentation · 2. Different Screen Resolutions · 3. Updated Device Models · 4. Testing a Mobile App on Staging · 5....
Read more >
Why Mobile Application Testing Fails? 8 Challenges ... - Amzur
8 Key Mobile Application Testing Challenges and Their Solutions ; Have you ever used a mobile app with bugs? Did you uninstall that...
Read more >
Top 7 Common Mobile App Testing challenges faced by ...
Screen Sizes: As we know Android and iPhone are the two dominants in the world of the smartphone industry, there is a plethora...
Read more >
Mobile App Testing Challenges & How to Overcome Them
Huge list of operating systems: · 2. Network Diversity: · Large browser matrix: · 4. UX & app performance issues: · 5. Lesser...
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