From 35f06573d6de469db7f18958362e14d44da1ffee Mon Sep 17 00:00:00 2001 From: harlan Date: Wed, 4 Sep 2024 02:58:14 +1000 Subject: [PATCH] chore: fix flaky test --- test/e2e/extend-registry.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e/extend-registry.test.ts b/test/e2e/extend-registry.test.ts index d811fb87..84e10b19 100644 --- a/test/e2e/extend-registry.test.ts +++ b/test/e2e/extend-registry.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { createResolver } from '@nuxt/kit' -import { createPage, setup } from '@nuxt/test-utils/e2e' +import { createPage, setup, url } from '@nuxt/test-utils/e2e' import { parseURL } from 'ufo' const { resolve } = createResolver(import.meta.url) @@ -13,7 +13,7 @@ await setup({ describe('basic', () => { it('extended registry script loads and executes function', async () => { - const page = await createPage('/') + const page = await createPage() const logs: { text: string, location: string }[] = [] // visit and collect all logs, we need to do a snapshot on them page.addListener('console', (msg) => { @@ -22,8 +22,9 @@ describe('basic', () => { location: `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`, }) }) + await page.goto(url('/')) await page.waitForTimeout(5000) - expect(logs).toMatchInlineSnapshot(` + expect(logs.filter(log => !log.location.startsWith('/_nuxt'))).toMatchInlineSnapshot(` [ { "location": "/myScript.js:1",