Skip to content

Commit 158db33

Browse files
committed
wip(vitest-migration): all tests passing
1 parent 4ee0dad commit 158db33

12 files changed

+94
-68
lines changed

packages/vue/__tests__/Transition.spec.ts renamed to packages/vue/__tests__/e2e/Transition.spec.ts

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,30 @@ describe('e2e: Transition', () => {
2121
})
2222
})
2323

24-
beforeEach(async () => {
25-
await page().goto(baseUrl)
26-
await page().waitForSelector('#app')
27-
})
24+
// beforeEach(async () => {
25+
// await page().goto(baseUrl)
26+
// await page().waitForSelector('#app')
27+
// })
2828

29-
describe('transition with v-if', () => {
29+
// workaround for https://github.com/vitest-dev/vitest/issues/2756
30+
function runTest(desc: string, runner: any, timeout?: number) {
3031
test(
32+
desc,
33+
async () => {
34+
await page().goto(baseUrl)
35+
await page().waitForSelector('#app')
36+
await runner()
37+
},
38+
timeout
39+
)
40+
}
41+
42+
describe('transition with v-if', () => {
43+
runTest(
3144
'basic transition',
3245
async () => {
46+
await page().goto(baseUrl)
47+
await page().waitForSelector('#app')
3348
await page().evaluate(() => {
3449
const { createApp, ref } = (window as any).Vue
3550
createApp({
@@ -83,7 +98,7 @@ describe('e2e: Transition', () => {
8398
E2E_TIMEOUT
8499
)
85100

86-
test(
101+
runTest(
87102
'named transition',
88103
async () => {
89104
await page().evaluate(() => {
@@ -139,7 +154,7 @@ describe('e2e: Transition', () => {
139154
E2E_TIMEOUT
140155
)
141156

142-
test(
157+
runTest(
143158
'custom transition classes',
144159
async () => {
145160
await page().evaluate(() => {
@@ -200,7 +215,7 @@ describe('e2e: Transition', () => {
200215
E2E_TIMEOUT
201216
)
202217

203-
test(
218+
runTest(
204219
'transition with dynamic name',
205220
async () => {
206221
await page().evaluate(() => {
@@ -262,7 +277,7 @@ describe('e2e: Transition', () => {
262277
E2E_TIMEOUT
263278
)
264279

265-
test(
280+
runTest(
266281
'transition events without appear',
267282
async () => {
268283
const beforeLeaveSpy = vi.fn()
@@ -366,7 +381,7 @@ describe('e2e: Transition', () => {
366381
E2E_TIMEOUT
367382
)
368383

369-
test(
384+
runTest(
370385
'events with arguments',
371386
async () => {
372387
const beforeLeaveSpy = vi.fn()
@@ -482,7 +497,7 @@ describe('e2e: Transition', () => {
482497
E2E_TIMEOUT
483498
)
484499

485-
test('onEnterCancelled', async () => {
500+
runTest('onEnterCancelled', async () => {
486501
const enterCancelledSpy = vi.fn()
487502

488503
await page().exposeFunction('enterCancelledSpy', enterCancelledSpy)
@@ -544,7 +559,7 @@ describe('e2e: Transition', () => {
544559
expect(await html('#container')).toBe('<!--v-if-->')
545560
})
546561

547-
test(
562+
runTest(
548563
'transition on appear',
549564
async () => {
550565
const appearClass = await page().evaluate(async () => {
@@ -620,7 +635,7 @@ describe('e2e: Transition', () => {
620635
E2E_TIMEOUT
621636
)
622637

623-
test(
638+
runTest(
624639
'transition events with appear',
625640
async () => {
626641
const onLeaveSpy = vi.fn()
@@ -768,7 +783,7 @@ describe('e2e: Transition', () => {
768783
E2E_TIMEOUT
769784
)
770785

771-
test(
786+
runTest(
772787
'css: false',
773788
async () => {
774789
const onBeforeEnterSpy = vi.fn()
@@ -846,7 +861,7 @@ describe('e2e: Transition', () => {
846861
E2E_TIMEOUT
847862
)
848863

849-
test(
864+
runTest(
850865
'no transition detected',
851866
async () => {
852867
await page().evaluate(() => {
@@ -888,7 +903,7 @@ describe('e2e: Transition', () => {
888903
E2E_TIMEOUT
889904
)
890905

891-
test(
906+
runTest(
892907
'animations',
893908
async () => {
894909
await page().evaluate(() => {
@@ -940,7 +955,7 @@ describe('e2e: Transition', () => {
940955
E2E_TIMEOUT
941956
)
942957

943-
test(
958+
runTest(
944959
'explicit transition type',
945960
async () => {
946961
await page().evaluate(() => {
@@ -1010,7 +1025,7 @@ describe('e2e: Transition', () => {
10101025
E2E_TIMEOUT
10111026
)
10121027

1013-
test(
1028+
runTest(
10141029
'transition on SVG elements',
10151030
async () => {
10161031
await page().evaluate(() => {
@@ -1081,7 +1096,7 @@ describe('e2e: Transition', () => {
10811096
E2E_TIMEOUT
10821097
)
10831098

1084-
test(
1099+
runTest(
10851100
'custom transition higher-order component',
10861101
async () => {
10871102
await page().evaluate(() => {
@@ -1138,7 +1153,7 @@ describe('e2e: Transition', () => {
11381153
E2E_TIMEOUT
11391154
)
11401155

1141-
test(
1156+
runTest(
11421157
'transition on child components with empty root node',
11431158
async () => {
11441159
await page().evaluate(() => {
@@ -1217,7 +1232,7 @@ describe('e2e: Transition', () => {
12171232

12181233
describe('transition with Suspense', () => {
12191234
// #1583
1220-
test(
1235+
runTest(
12211236
'async component transition inside Suspense',
12221237
async () => {
12231238
const onLeaveSpy = vi.fn()
@@ -1311,7 +1326,7 @@ describe('e2e: Transition', () => {
13111326
)
13121327

13131328
// #1689
1314-
test(
1329+
runTest(
13151330
'static node transition inside Suspense',
13161331
async () => {
13171332
await page().evaluate(() => {
@@ -1369,7 +1384,7 @@ describe('e2e: Transition', () => {
13691384
E2E_TIMEOUT
13701385
)
13711386

1372-
test(
1387+
runTest(
13731388
'out-in mode with Suspense',
13741389
async () => {
13751390
const onLeaveSpy = vi.fn()
@@ -1436,7 +1451,7 @@ describe('e2e: Transition', () => {
14361451
)
14371452

14381453
// #3963
1439-
test(
1454+
runTest(
14401455
'Suspense fallback should work with transition',
14411456
async () => {
14421457
await page().evaluate(() => {
@@ -1500,7 +1515,7 @@ describe('e2e: Transition', () => {
15001515
})
15011516

15021517
describe('transition with v-show', () => {
1503-
test(
1518+
runTest(
15041519
'named transition with v-show',
15051520
async () => {
15061521
await page().evaluate(() => {
@@ -1559,7 +1574,7 @@ describe('e2e: Transition', () => {
15591574
E2E_TIMEOUT
15601575
)
15611576

1562-
test(
1577+
runTest(
15631578
'transition events with v-show',
15641579
async () => {
15651580
const beforeLeaveSpy = vi.fn()
@@ -1665,7 +1680,7 @@ describe('e2e: Transition', () => {
16651680
E2E_TIMEOUT
16661681
)
16671682

1668-
test(
1683+
runTest(
16691684
'onLeaveCancelled (v-show only)',
16701685
async () => {
16711686
const onLeaveCancelledSpy = vi.fn()
@@ -1727,7 +1742,7 @@ describe('e2e: Transition', () => {
17271742
E2E_TIMEOUT
17281743
)
17291744

1730-
test(
1745+
runTest(
17311746
'transition on appear with v-show',
17321747
async () => {
17331748
const beforeEnterSpy = vi.fn()
@@ -1833,7 +1848,7 @@ describe('e2e: Transition', () => {
18331848
)
18341849

18351850
// #4845
1836-
test(
1851+
runTest(
18371852
'transition events should not call onEnter with v-show false',
18381853
async () => {
18391854
const beforeEnterSpy = vi.fn()
@@ -1907,7 +1922,7 @@ describe('e2e: Transition', () => {
19071922
})
19081923

19091924
describe('explicit durations', () => {
1910-
test(
1925+
runTest(
19111926
'single value',
19121927
async () => {
19131928
await page().evaluate(duration => {
@@ -1963,7 +1978,7 @@ describe('e2e: Transition', () => {
19631978
E2E_TIMEOUT
19641979
)
19651980

1966-
test(
1981+
runTest(
19671982
'enter with explicit durations',
19681983
async () => {
19691984
await page().evaluate(duration => {
@@ -2019,7 +2034,7 @@ describe('e2e: Transition', () => {
20192034
E2E_TIMEOUT
20202035
)
20212036

2022-
test(
2037+
runTest(
20232038
'leave with explicit durations',
20242039
async () => {
20252040
await page().evaluate(duration => {
@@ -2075,7 +2090,7 @@ describe('e2e: Transition', () => {
20752090
E2E_TIMEOUT
20762091
)
20772092

2078-
test(
2093+
runTest(
20792094
'separate enter and leave',
20802095
async () => {
20812096
await page().evaluate(duration => {
@@ -2134,7 +2149,7 @@ describe('e2e: Transition', () => {
21342149
E2E_TIMEOUT
21352150
)
21362151

2137-
test(
2152+
runTest(
21382153
'warn invalid durations',
21392154
async () => {
21402155
createApp({
@@ -2172,7 +2187,7 @@ describe('e2e: Transition', () => {
21722187
)
21732188
})
21742189

2175-
test('warn when used on multiple elements', async () => {
2190+
runTest('warn when used on multiple elements', async () => {
21762191
createApp({
21772192
render() {
21782193
return h(Transition, null, {
@@ -2185,7 +2200,7 @@ describe('e2e: Transition', () => {
21852200
).toHaveBeenWarned()
21862201
})
21872202

2188-
test('warn when invalid transition mode', () => {
2203+
runTest('warn when invalid transition mode', () => {
21892204
createApp({
21902205
template: `
21912206
<div id="container">
@@ -2199,7 +2214,7 @@ describe('e2e: Transition', () => {
21992214
})
22002215

22012216
// #3227
2202-
test(`HOC w/ merged hooks`, async () => {
2217+
runTest(`HOC w/ merged hooks`, async () => {
22032218
const innerSpy = vi.fn()
22042219
const outerSpy = vi.fn()
22052220

@@ -2238,7 +2253,7 @@ describe('e2e: Transition', () => {
22382253
expect(root.innerHTML).toBe(`<!---->`)
22392254
})
22402255

2241-
test(
2256+
runTest(
22422257
'should work with dev root fragment',
22432258
async () => {
22442259
await page().evaluate(() => {

0 commit comments

Comments
 (0)