-
Notifications
You must be signed in to change notification settings - Fork 157
TypeError: Cannot read property 'options' of undefined #267
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 found vue-jest@next use you can put ts-jest, jest, @types/jest back to 24.x. yarn add @types/jest^24.9.1 jest^24.9.0 ts-jest^24.3.0 --dev --force |
@PeckZeg should I need to downgrade '@vue/test-utils' version also? |
no need. all beta version has this problem |
I have your exact dependencies and it's working fine for me. Did you get this working with the latest Can you provide a repo with this not working? Vue CLI should have this working out of the box. Fwiw I do not expect upgrading projects from Vue 2 to Vue 3 to be easy - VTU v2 is usable but still in it's early days and there are likely some undocumented behaviors many libraries came to rely on that have not been ported. |
Got same error. Switched back to ts-jest^24.0.0 as suggested and it works again. Here is stack trace. TypeError: Cannot read property 'options' of undefined
When I try looking at the undefined object, it seems like the typescript key is undefined. It isn't even defined in the type definition for the createTransformer that calls it.
const createTransformer = require('ts-jest').createTransformer
const tr = createTransformer()
const { typescript } = tr.configsFor(config)
// Force es5 to prevent const vue_1 = require('vue') from conflicting
return { compilerOptions: { ...typescript.options, target: 'es5' } } When you try and log the same object from a version that does work, it doesn't even get called. Seems to be looking for some typescript config file/key out of the jest.config. That's about all I was able to garner, hope it helps a bit. |
I pulled this branch of my course https://github.com/lmiller1990/vuejs-composition-course/tree/1.3-reactive-updates-using-ref, ran
|
@shortpoet I see the error - how can I reproduce this? How did set this up? Vue CLI, another template, by yourself? Can you post a minimal repo? Using Vue + Jest + TS requires many different libraries to all "work" together, maybe we need to document which version(s) of things to use. Ideally we should just use the latest stable version for everything, which I think is TS 3.x, Jest 25.x or 26.x. |
Hello @lmiller1990 you will find the error in this repo. |
@gem007bd your |
@shortpoet/Carlos can you repro the error w/ matching ts-jest and jest? Seem this is the "bug" - not having the correct versions. |
when i use npm this problem is no occur |
https://github.com/Vicula/vue-tsx
I can reproduce the above issue still. @lmiller1990 Using vue 3 single file component setup with TSX for render function. Having problem running jest tests and getting same above error.
|
|
Can you try using Jest 26? You have Jest 27 - it has breaking changes. A similar issue. We are working on Jest 27 support here: #343 |
|
I am facing this error even for the simple test case with the latest version. I am trying to update vue2 to vue3
I am using:
"vue": "^3.0.0-rc.5",
"vuex": "^4.0.0-beta.4",
"vue-jest": "^5.0.0-alpha.3",
"@vue/test-utils": "^2.0.0-beta.2"
Test suite failed to run
The text was updated successfully, but these errors were encountered: