Open Evertvdw opened 3 years ago
Ok, nobody does unit tests in combination with class components?
I also ran into another issue with Vue-class-components in another library. Maybe that is related? https://github.com/quasarframework/quasar/issues/8915#issuecomment-822000736
Before with class components the options were besides the render
method on the class. But now they are under a subkey __c
, maybe this trips up unit tests also. Anyone know why this is different going from Vue 2 -> Vue 3?
Ok, it seems importing Vue from vue-class-component
instead of vue-property-decorator
fixes this issue. However when you have a component which extends from a mixin, you get this issue again. Even if that mixin also imports Vue from vue class components.
I got similar issue when I try to write unit tests for my class-style code using vue-test-utils. You would find that when you use Vue.with()
instead of Vue
as the parent class the problem appears again.
Created an issue on vue-test-utils about this: https://github.com/vuejs/vue-test-utils-next/issues/544#issuecomment-831098165
Although the issue seems to be originating from vue-jest
:)
Hi there!
I started with migrating our codebase from Vue 2 with class components to Vue 3. The project doesn't run yet with Vue 3 but I'm already looking at our unit tests to see if I can get a setup with
jest
andvue-test-utils
working. I'm running in a strange issue however, not sure how to proceed.I have the following minimal component:
And I created a unit test for that (file
DefaultComponent.spec.ts
):The
createWrapper
is a custom function in which I do some general setup and eventually do areturn mount(DefaultComponent, {...options})
. I have the following packages installed:When I run this test it gives the following output:
Anyone have any idea why this is happening? If anyone has unit tests with class components working I would very much love some examples, because my search so far is turning up empty.
Thanks!