From b0d1d6ae87562f285a474fb796fc8036ceebac5c Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 28 Feb 2025 21:11:41 +0000 Subject: [PATCH] test: add some more stability in hmr tests --- test/hmr.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/hmr.test.ts b/test/hmr.test.ts index 9eaf5fd7b3..2e608a8104 100644 --- a/test/hmr.test.ts +++ b/test/hmr.test.ts @@ -1,6 +1,6 @@ import { promises as fsp } from 'node:fs' import { fileURLToPath } from 'node:url' -import { describe, expect, it } from 'vitest' +import { beforeAll, describe, expect, it } from 'vitest' import { isWindows } from 'std-env' import { join } from 'pathe' import { $fetch as _$fetch, fetch, setup } from '@nuxt/test-utils/e2e' @@ -29,7 +29,7 @@ if (process.env.TEST_ENV !== 'built' && !isWindows) { const indexVue = await fsp.readFile(join(fixturePath, 'pages/index.vue'), 'utf8') describe('hmr', () => { - it('should load dev server', async () => { + beforeAll(async () => { await expectWithPolling(() => $fetch('/').then(r => r.includes('Home page')).catch(() => null), true) }) @@ -151,6 +151,8 @@ if (process.env.TEST_ENV !== 'built' && !isWindows) { await fsp.writeFile(join(fixturePath, 'pages/routes/non-existent.vue'), ``) + await expectWithPolling(() => consoleLogs.some(log => log.text.includes('hmr')), true) + await page.getByRole('link').click() await expectWithPolling(() => page.getByTestId('contents').textContent(), 'A new route!')