-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Running mocha tests fails with 'Module parse failed' at typescript optional chaining operator #6833
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
Comments
I should add that this is basically fresh from the template vue-cli has created for me, that is it is a minimization of the issue I see in the real product. I'm still investigating what the crucial diff in package-lock between the running and failing versions is. But maybe someone has a hint (e.g. any known babel issues?) |
I have the same issue any news. |
I've got it back to running in our "real" project. But only by going back to a package-lock.json based on I did not yet try creating a fresh project with this cli version, maybe that works, too, as a minimization. The only thing I have definitely verified: Upgrading to vue-cli beyond ~4.3 re-introduces the error, i.e. breaks my package-lock.json ( break as in downgrading cli back to 4.3 does not fix the build. Only after reverting back to the old lock file. |
There are 2 workaround options.
plugins: [
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
] |
Thank you very much. I can confirm that this solves the issue for me. Can the defaults in Vue-CLI be adapted accordingly to help future users? |
I complement the answer for || = and similar operators. Add to plugins '@babel/plugin-proposal-logical-assignment-operators'. |
Version
4.5.15
Reproduction link
github.com
Environment info
Steps to reproduce
Checkout current main of reproducer repository (faf2ae989ad at the time of writing)
Run
npm install && npm run test:unit
What is expected?
The one test is run and completes successfully. Just as it does if I remove the offending typescript code.
What is actually happening?
Serving and building work, i.e. both
npm run build
andnpm run serve
complete successfullyPlease let me know if you need any more information.
The text was updated successfully, but these errors were encountered: