Skip to content

Commit e478755

Browse files
committed
wip(vitest-migration): compat tests passing
1 parent dca4224 commit e478755

11 files changed

+38
-5
lines changed

packages/vue-compat/__tests__/compiler.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { vi } from 'vitest'
25
import Vue from '@vue/compat'
36
import { nextTick } from '@vue/runtime-core'

packages/vue-compat/__tests__/componentAsync.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import Vue from '@vue/compat'
25
import {
36
DeprecationTypes,

packages/vue-compat/__tests__/componentFunctional.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import Vue from '@vue/compat'
25
import {
36
DeprecationTypes,
@@ -52,7 +55,7 @@ describe('COMPONENT_FUNCTIONAL', () => {
5255
expect(vm.$el.querySelector('.inject').textContent).toBe('123')
5356
expect(vm.$el.querySelector('.slot').textContent).toBe('hello')
5457
expect(vm.$el.outerHTML).toMatchInlineSnapshot(
55-
`"<div id="foo" class="foo"><div class="inject">123</div><div class="slot">hello</div></div>"`
58+
'"<div id=\\"foo\\" class=\\"foo\\"><div class=\\"inject\\">123</div><div class=\\"slot\\">hello</div></div>"'
5659
)
5760

5861
expect(

packages/vue-compat/__tests__/componentVModel.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import Vue from '@vue/compat'
25
import { ComponentOptions } from '../../runtime-core/src/component'
36
import { nextTick } from '../../runtime-core/src/scheduler'

packages/vue-compat/__tests__/filters.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import Vue from '@vue/compat'
25
import { CompilerDeprecationTypes } from '../../compiler-core/src'
36
import {

packages/vue-compat/__tests__/global.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { vi } from 'vitest'
25
import Vue from '@vue/compat'
36
import { effect, isReactive } from '@vue/reactivity'

packages/vue-compat/__tests__/globalConfig.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { vi } from 'vitest'
25
import Vue from '@vue/compat'
36
import {

packages/vue-compat/__tests__/instance.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { vi } from 'vitest'
1+
/**
2+
* @vitest-environment jsdom
3+
*/
4+
import { vi, Mock } from 'vitest'
25
import Vue from '@vue/compat'
36
import { Slots } from '../../runtime-core/src/componentSlots'
47
import { Text } from '../../runtime-core/src/vnode'
@@ -50,7 +53,7 @@ test('INSTANCE_DESTROY', () => {
5053
// https://github.com/vuejs/vue/blob/dev/test/unit/features/instance/methods-events.spec.js
5154
describe('INSTANCE_EVENT_EMITTER', () => {
5255
let vm: LegacyPublicInstance
53-
let spy: vi.Mock
56+
let spy: Mock
5457

5558
beforeEach(() => {
5659
vm = new Vue()
@@ -61,7 +64,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
6164
vm.$on('test', function (this: any) {
6265
// expect correct context
6366
expect(this).toBe(vm)
64-
spy.apply(this, arguments)
67+
spy.apply(this, arguments as unknown as any[])
6568
})
6669
vm.$emit('test', 1, 2, 3, 4)
6770
expect(spy).toHaveBeenCalledTimes(1)
@@ -74,7 +77,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
7477
it('$on multi event', () => {
7578
vm.$on(['test1', 'test2'], function (this: any) {
7679
expect(this).toBe(vm)
77-
spy.apply(this, arguments)
80+
spy.apply(this, arguments as unknown as any[])
7881
})
7982
vm.$emit('test1', 1, 2, 3, 4)
8083
expect(spy).toHaveBeenCalledTimes(1)

packages/vue-compat/__tests__/misc.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { vi } from 'vitest'
25
import Vue from '@vue/compat'
36
import { nextTick } from '../../runtime-core/src/scheduler'

packages/vue-compat/__tests__/options.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { vi } from 'vitest'
25
import Vue from '@vue/compat'
36
import { nextTick } from '../../runtime-core/src/scheduler'

packages/vue-compat/__tests__/renderFn.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
14
import { ShapeFlags } from '@vue/shared'
25
import Vue from '@vue/compat'
36
import { createComponentInstance } from '../../runtime-core/src/component'

0 commit comments

Comments
 (0)