diff --git a/playground/fs-serve/__tests__/commonTests.ts b/playground/fs-serve/__tests__/commonTests.ts index 06c58fae6..a5b3fb958 100644 --- a/playground/fs-serve/__tests__/commonTests.ts +++ b/playground/fs-serve/__tests__/commonTests.ts @@ -601,7 +601,7 @@ describe.runIf(!isServe)('preview HTML', () => { }) test.runIf(isServe)( - 'load script with no-cors mode from a different origin', + 'serve regular scripts independently of cross-origin fetch metadata', async () => { const viteTestUrlUrl = new URL(viteTestUrl) @@ -629,9 +629,7 @@ test.runIf(isServe)( }) expect(res.statusCode).toBe(200) const body = Buffer.concat(await ArrayFromAsync(res)).toString() - expect(body).toContain( - 'Cross-origin requests for classic scripts must be made with CORS mode enabled.', - ) + expect(body).toContain('// code.js') }, ) diff --git a/playground/hmr-full-bundle-mode/__tests__/hmr-full-bundle-mode.spec.ts b/playground/hmr-full-bundle-mode/__tests__/hmr-full-bundle-mode.spec.ts index 0c78cb863..99dbdc527 100644 --- a/playground/hmr-full-bundle-mode/__tests__/hmr-full-bundle-mode.spec.ts +++ b/playground/hmr-full-bundle-mode/__tests__/hmr-full-bundle-mode.spec.ts @@ -95,14 +95,20 @@ if (isBuild) { // BUNDLED -> GENERATING_HMR_PATCH -> BUNDLED test('generate hmr patch', async () => { await expect.poll(() => page.textContent('.hmr')).toBe('hello') + const hmrPatchFileRes = page.waitForResponse(/\/hmr_patch_\d\.js$/) editFile('hmr.js', (code) => code.replace("const foo = 'hello'", "const foo = 'hello1'"), ) - await expect.poll(() => page.textContent('.hmr')).toBe('hello1') + try { + await expect.poll(() => page.textContent('.hmr')).toBe('hello1') - editFile('hmr.js', (code) => - code.replace("const foo = 'hello1'", "const foo = 'hello'"), - ) + const hmrPatch = await (await hmrPatchFileRes).text() + expect(() => Function(hmrPatch)).toThrow(SyntaxError) + } finally { + editFile('hmr.js', (code) => + code.replace("const foo = 'hello1'", "const foo = 'hello'"), + ) + } await expect.poll(() => page.textContent('.hmr')).toContain('hello') await expect.poll(() => page.textContent('.asset')).toMatch(assetUrl) })