Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b1bae5e

Browse files
fix: patch for @vue/test-utils@1.x with Vue@2.7.x
1 parent 4b6358b commit b1bae5e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

‎template/config/typescript/env.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
/// <reference types="vite/client" />
2+
3+
import type { ComponentPublicInstanceConstructor } from 'vue/types/v3-component-public-instance'
4+
5+
/**
6+
* patch for @vue/test-utils@1.x with Vue@2.7.x
7+
* @see https://github.com/vuejs/vue-test-utils/issues/2087#issuecomment-1919820059
8+
*/
9+
declare module '@vue/test-utils' {
10+
export function mount<T extends ComponentPublicInstanceConstructor>(
11+
originalComponent: T,
12+
options?: ThisTypedMountOptions<Vue>
13+
): Wrapper<Vue>
14+
}

‎template/config/vitest/src/components/__tests__/HelloWorld.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import HelloWorld from '../HelloWorld.vue'
55

66
describe('HelloWorld', () => {
77
it('renders properly', () => {
8-
// TODO: https://github.com/vuejs/vue-test-utils/issues/2087
9-
// @ts-ignore
108
const wrapper = mount(HelloWorld, { propsData: { msg: 'Hello Vitest' } })
119
expect(wrapper.text()).toContain('Hello Vitest')
1210
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /