-
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
feat: support <script setup> in Vue 2.7 #483
Conversation
@@ -11,8 +11,9 @@ const stripInlineSourceMap = require('./utils').stripInlineSourceMap | |||
const getCustomTransformer = require('./utils').getCustomTransformer | |||
const loadSrc = require('./utils').loadSrc | |||
const babelTransformer = require('babel-jest').default | |||
const compilerUtils = require('@vue/component-compiler-utils') | |||
const { parse, compileTemplate, compileScript } = require('@vue/compiler-sfc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vue/compiler-sfc
isn't listed as a dependency of this package, so this import is unsound. There is a similar existing issue for the vue-template-compiler
import as well (which should probably have been listed as an optional peer dependency).
I know there are other changes in vue 2.7 that make vue-template-compiler no longer necessary, so there might be larger refactors in the works for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't @vue/compiler-sfc
Vue 3 only? I'm really surprised this works at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also looks like tests are failing - you may need to update a snapshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, they now have a v2.7 for this module: https://www.npmjs.com/package/@vue/compiler-sfc
Are those changes moving forward? |
Sorry about the delay. Need to fix CI, then we can. @FelixGraf are you able to take a look? 🙏 Again sorry about the slow response - I am not really working on Vue Jest now, but we don't really have any other maintainer, so happy to help push things forward for now. |
Yes, I will be able to take a look at it again this week. |
@FelixGraf are you finally moving this forward? If not, I might be able to take a look at it. |
@kiroushi I say just go for it, I think we are all aligned in what we want - 2.7 support. |
@lmiller1990 can you take a look at #489? |
Done, pinged you there! Let's close this in favour of #489. |
* feat: support <script setup> in Vue 2.7 * refactor: remove unnecessary bindingMetadata * refactor: remove unnecessary refTransform * feat: add setup to generateSourceMap * chore: update Vue dependencies * fix: remove inline sourceMap in vue2 setup scripts * fix: update 2.x snapshot * fix: use appropriate package according to vue version * fix: rebase typo * fix: make script setup & script blocks work together * Update test.js.snap * fixing snapshots Co-authored-by: Felix Graf <[email protected]> Co-authored-by: Lachlan Miller <[email protected]>
This PR:
vue
andvue-template-compiler
) to the latest version (2.7.7
)<script setup>
syntax in Vue 2.7 componentsvue3-jest
package (https://github.com/vuejs/vue-jest/blob/master/packages/vue3-jest/lib/process.js#L51)