From 1855ea285d7b88117b91c7d1b6d5b819eb271af5 Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Thu, 7 Dec 2023 11:03:59 -0500 Subject: [PATCH] Update test to fail on unset config.base `pnpm test:workaround`, which deletes config.base, will now timeout. This is in response to: - https://github.com/vitest-dev/vitest/issues/4686#issuecomment-1844852092 --- demo.test.js | 12 ++++++++++-- index.html => hello.html | 0 2 files changed, 10 insertions(+), 2 deletions(-) rename index.html => hello.html (100%) diff --git a/demo.test.js b/demo.test.js index fa9a8a0..1c85d12 100644 --- a/demo.test.js +++ b/demo.test.js @@ -1,3 +1,11 @@ -import { test } from 'vitest' +import { expect, test } from 'vitest' -test('OK in <=1.0.0-beta.4+vite <=5.0.0-beta.7, breaks otherwise', () => null) +test('OK in <=1.0.0-beta.4+vite <=5.0.0-beta.7, breaks otherwise', async () => { + // This will timeout when config.base is undefined. + var page = window.open('/foobar/hello.html') + await new Promise(resolve => page.addEventListener('load', resolve)) + + let e = page.document.querySelector('body p') + + expect(e.textContent).toContain('Hello, World!') +}) diff --git a/index.html b/hello.html similarity index 100% rename from index.html rename to hello.html