8000 test: add some more stability in hmr tests · nuxt/nuxt@9a9fcda · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a9fcda

Browse files
committed
test: add some more stability in hmr tests
1 parent d4d80ad commit 9a9fcda

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/hmr.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { promises as fsp } from 'node:fs'
22
import { fileURLToPath } from 'node:url'
3-
import { describe, expect, it } from 'vitest'
3+
import { beforeAll, describe, expect, it } from 'vitest'
44
import { isWindows } from 'std-env'
55
import { join } from 'pathe'
66
import { $fetch, fetch, setup } from '@nuxt/test-utils/e2e'
@@ -28,7 +28,7 @@ if (process.env.TEST_ENV !== 'built' && !isWindows) {
2828
const indexVue = await fsp.readFile(join(fixturePath, 'pages/index.vue'), 'utf8')
2929

3030
describe('hmr', () => {
31-
it('should load dev server', async () => {
31+
beforeAll(async () => {
3232
await expectWithPolling(() => $fetch<string>('/').then(r => r.includes('Home page')).catch(() => null), true)
3333
})
3434

@@ -150,6 +150,8 @@ if (process.env.TEST_ENV !== 'built' && !isWindows) {
150150

151151
await fsp.writeFile(join(fixturePath, 'pages/routes/non-existent.vue'), `<template><div data-testid="contents">A new route!</div></template>`)
152152

153+
await expectWithPolling(() => consoleLogs.some(log => log.text.includes('hmr')), true)
154+
153155
await page.getByRole('link').click()
154156
await expectWithPolling(() => page.getByTestId('contents').textContent(), 'A new route!')
155157

0 commit comments

Comments
 (0)
0