Error while running jest tests
See original GitHub issueI am getting the below error while running the test suite. It seems to be working fine in the browser.
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/Users/kurund/....../node_modules/emoji-mart/dist/index.js:2768
export {$724e43cd4d4265a7$export$2e2bcd8739ae039 as Picker, $8b28a44b07620e42$export$2e2bcd8739ae039 as Emoji, $e43013e6209d8d65$export$2e2bcd8739ae039 as SearchIndex, $2e94d13d43a3b87d$export$2e2bcd8739ae039 as FrequentlyUsed, $205291deb9107ba0$export$2cd8252107eb640b as init, $205291deb9107ba0$export$2d0294657ab35f1b as Data, $205291deb9107ba0$export$dbe3113d60765c1a as I18n};
^^^^^^
SyntaxError: Unexpected token 'export'
1 | import React, { useEffect, useRef } from 'react';
2 | import data from '@emoji-mart/data';
> 3 | import { Picker } from 'emoji-mart';
I am using “emoji-mart”: “^5.1.0”, “@emoji-mart/data”: “^1.0.2”,
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:11 (2 by maintainers)
Top 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
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 test error while running test cases · Issue #2345
Since all files inside node_modules are not transformed by default, Jest will not understand the code in these modules, resulting in syntax errors....
Read more >Error while running jest test case in intellij through jest config.
Hi Team, Facing this issue while running the jest test case through configuration. Please look into this. module exists though in the node_modules...
Read more >Validation Error when running jest command within node ...
So after looking into this more. It seems the problem is that the command was being run in the .blitz/build folder since that...
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
@RustamY
We previously used
"emoji-mart": "^3.0.0"
@EtienneLem
I would really appreciate any suggestions to resolve this and would be happy to help. Thank you.