-
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
v.27.0.0-alpha.2 - TypeError: Jest: a transform must export a process
function.
#383
Comments
process
function.process
function.
process
function.process
function.
cc. @lmiller1990 Not sure how I specifically pin this to the v.27.0.0 alpha ... |
Also example from babel-jest https://github.com/facebook/jest/blob/master/packages/babel-jest/src/index.ts#L278 |
@ahnpnl I have one minor question - do I need to supply my own Processors must return an object with a "process" method, like so...
Although, I'm not sure where or how or what I do to achieve this ... |
You can write your own Jest transformer if you want to process certain file extensions for Jest. Regarding to the change of how to write a Jest transformer, it was a breaking change introduced in Jest 27. You can either follow |
@ahnpnl Hmmmm, I'm not really sure how to tackle this to be honest to even start with a PR. |
https://github.com/vuejs/vue-jest/blob/master/packages/vue3-jest/lib/index.js#L3 instead of
should change to
This I copied from https://github.com/facebook/jest/blob/master/packages/babel-jest/src/index.ts#L278 |
@lmiller1990 Sorry to bother you again Lachlan ... do you have any opinions on the above issues I have? |
Hi, this issue is still dangling without any comment from anyone in the core team of this package. I'm a bit concerned, have I neglected to add additional configuration for Jest 27 or does this need patching by the vie-jest team? |
Hello, sorry about the slow reply. I will take a look, but from what I can see, Vue CLI now works great with Jest 27: https://github.com/vuejs/vue-cli/releases/tag/v5.0.0-beta.4 Also, is there a way to reproduce the issue you are having? We have quite a lot of tests, including Are you using Vue 2 or Vue 3? I'm a bit confused. Happy to help, but going to need more clear instructions on the versions, what is not working, etc. |
I'm also facing this issue Related configuration: {
transform: {
'^.+\\.vue$': '@vue/vue2-jest'
},
globals: {
'vue-jest': {
transform: {
ts: require('babel-jest').default,
tsx: require('babel-jest').default
}
}
}
} When using custom transformers i could only get it to work when requiring the package. We use babel instead of However when the tests run This is using |
interop custom transformer require. Some transformers may not interop correctly when requiring, return `transformer.default` or `transformer`. fixes vuejs#383
interop custom transformer require. Some transformers may not interop correctly when requiring, return `transformer.default` or `transformer`. fixes vuejs#383
interop custom transformer require. Some transformers may not interop correctly when requiring, return `transformer.default` or `transformer`. fixes #383
According to the ts-jest team, this way (https://github.com/vuejs/vue-jest/blob/v27.0.0-alpha.2/packages/vue3-jest/lib/index.js#L3) of exporting transformer no longer works with Jest 27.
The right way to export transformer is show here: https://github.com/kulshekhar/ts-jest/blob/master/src/index.ts :
The text was updated successfully, but these errors were encountered: