-
Notifications
You must be signed in to change notification settings - Fork 156
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
Incompatibility with Prettier v3 #550
Comments
Oh this is gold, spent days on this. |
Thanks @threepipes for posting the solution. I also struggled to find the cause of the issue. The straightforward solution is to simply not prettify the compilation output when processing the template. @lmiller1990, is there a use case for it in the context of this plugin? If not I'm happy to submit a PR to change this behavior (like this). |
I guess the main reason to do this is for better stack traces/error messages. Although broken out of the box is definitely not ideal... should we just default to having prettier off? Any way to fix this so it works out of the box with formatting? |
I reproduced the issue on this repo and tried to see what benefits the formatting with prettier brings by using Prettier 2 and making the test fail. With and without Prettier, the output is the same: If I force an error in the template, then I can see an error in the output (location in the proxy render): But I don't know if this is helping a lot. Is it possible to analyse the compiled template in case of failure? All this to say, offering the possibility to prettify the output of the template compiler might be unnecessary. If that's the case we can just solve the issue by always passing |
Reproduction and the test result
https://github.com/threepipes/vue-jest-prettier-issue
What happened?
The
jest
test passes with prettier v2.8.8 but fails when updated to v3.0.0 or higher.Description
prettier
is invoked here through the compiler-sfc, butcompiler-sfc
doesn't impose any version restriction onprettier
, whereascomponent-compiler-utils
does.With the release of
prettier
v3, the interface has changed. As a result,vue-jest
fails to transform.vue
files properly.Error
Workaround
The issue can be avoided by modifying the Jest configuration settings as shown below:
https://github.com/vuejs/component-compiler-utils/blob/82a37174990e31eaec609887a0ec262f06b454dd/lib/compileTemplate.ts#L175
The text was updated successfully, but these errors were encountered: