I write my component with composition API in Vue 2.7, and I also use <script setup> in my component.
When I run the test, I got the warning message in the console
console.error
[Vue warn]: Unknown custom element: <CustomComponent> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <Anonymous>
<Root>
3 |
4 | describe('CustomComponent component', () => {
> 5 | const wrapper = mount(CustomComponent);
| ^
6 |
7 | it('renders component correctly', () => {
8 | expect(wrapper.element).toMatchSnapshot();
Does anyone have encountered the similar issue and solve it successful?
Hi everyone
I write my component with composition API in Vue 2.7, and I also use
<script setup>
in my component. When I run the test, I got the warning message in the consoleDoes anyone have encountered the similar issue and solve it successful?
My component is more like below
test case
Environment
vue: ^2.7.10 @vue/vue2-jest: ^29.0.0 babel-jest: 29.0.3 @vue/test-utils: ^1.3.0