-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Jest - SyntaxError: Unexpected token 'export #293
Comments
Hello @EdouardPauw, sorry for the late reply. For that particular problem, it's related to the fact that Node historically only supported CommonJS modules, but EcmaScript modules (a.k.a. "ESM") is a newer syntax for importing packages that leverages a different module loading scheme. There are more comprehensive guides on the differences between the two, suffice to say that, before Node 14, something had to convert the imports between the two. TypeScript typically handles this if your codebase gets transpiled by it before any code is sent to Node, but if you're using SimpleWebAuthn in a JavaScript codebase then you'll likely need to leverage some capability hopefully in Jest to handle this conversion. Have you had a chance to try the potential solution at https://jestjs.io/docs/ecmascript-modules that's mentioned in the error message? |
Hello @MasterKalen, thank you for your answer. I did not have time to work on it the last days but I finaly found the solution today!
The solution I found is :
Thanks a lot for your time ! :) |
I'm glad to hear you got it working correctly. Perhaps I should start documenting these framework-specific fixes... 🤔 |
Hello,
I have implemented webAuthn on my current login page thanks to your library.
But now when I'm running the already existing test this error is displayed :
I spent a lot of time trying to resolving this error with no success ...
I already tried :
I think my main issue is that I do not really understand why this error happen.
The text was updated successfully, but these errors were encountered: