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
Error when running react-script test with jest #264
Comments
any solutions for this |
See some more discussion of this in #221 |
Any progress on this? Can I help by providing a MWE? #221 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I tried to use the useMediaQuery hook from your library (btw good job with creating so many useful hooks)
import { useMediaQuery } from "@uidotdev/usehooks";
Over the components we have tests that use jest test library. When I run the react-scripts test I get an error regarding the import of the useMediaQuery "SyntaxError: Cannot use import statement outside a module"
"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."
The line it seems to complains is "import * as React from "react";" . Is this something wrong on jest side or something can be done on how we use the "@uidotdev/usehooks" hooks?
The text was updated successfully, but these errors were encountered: