Problems testing my app
See original GitHub issueHi! 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:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
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.
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.