Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in jest test cases if screenfull is imported inside any jsx #222

Closed
pavanKumarTGMERN opened this issue Jul 26, 2023 · 1 comment
Closed

Comments

@pavanKumarTGMERN
Copy link

pavanKumarTGMERN commented Jul 26, 2023

If I use the screenfull library as shown below

import screenfull from 'screenfull';

The jest would throw the error as shown below

SyntaxError: Unexpected token 'export'

> 1 | import screenfull from 'screenfull';

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.

Please suggest on avoiding this import error

@sindresorhus
Copy link
Owner

This is not a problem with this package. Try asking on the Jest issue tracker instead.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants