unplugin / unplugin-vue2-script-setup

💡 Bring `<script setup>` to Vue 2.
MIT License
599 stars 39 forks source link

Jest is broken since v0.10.2 #139

Open dm4t2 opened 2 years ago

dm4t2 commented 2 years ago

I'm using a custom Jest transformer for usage with the Ref Sugar syntax:

const { raw } = require('unplugin-vue2-script-setup').default
const transform = raw({ reactivityTransform: true }).transform

module.exports = {
  process(source, filename, ...args) {
    const transformed = transform(source, filename)
    const code = transformed ? transformed.code : source
    return require('@vue/vue2-jest').process.call(this, code, filename, ...args)
  }
}

However, this no longer works when updating from v0.10.1 to v.0.10.2, even with await transform(...).

antfu commented 2 years ago

Can you share a minimal reproduction? Thanks.

dm4t2 commented 2 years ago

https://github.com/dm4t2/unplugin-vue2-script-setup-issue-139

antfu commented 2 years ago

You might need to use async processAsync hook instead of process. But it involved another issue of Jest https://github.com/facebook/jest/issues/11458