From ef564ae756abe199b7c1f88310dde75e1e96c5f1 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 26 Aug 2024 12:23:57 -0400 Subject: [PATCH] more --- .../_config.js | 9 +++++- .../samples/invalid-html-ssr/_config.js | 28 +++++++++++-------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/svelte/tests/runtime-runes/samples/event-global-hydration-error-cleanup/_config.js b/packages/svelte/tests/runtime-runes/samples/event-global-hydration-error-cleanup/_config.js index 62d0aae0b8..0b4c76782f 100644 --- a/packages/svelte/tests/runtime-runes/samples/event-global-hydration-error-cleanup/_config.js +++ b/packages/svelte/tests/runtime-runes/samples/event-global-hydration-error-cleanup/_config.js @@ -3,11 +3,18 @@ import { test } from '../../test'; export default test({ html: '

invalid

', + mode: ['hydrate'], + recover: true, + test({ assert, target, logs }) { target.click(); flushSync(); assert.deepEqual(logs, ['body', 'document', 'window']); - } + }, + + warnings: [ + 'Hydration failed because the initial UI does not match what was rendered on the server' + ] }); diff --git a/packages/svelte/tests/runtime-runes/samples/invalid-html-ssr/_config.js b/packages/svelte/tests/runtime-runes/samples/invalid-html-ssr/_config.js index 1e379f6b61..e537add382 100644 --- a/packages/svelte/tests/runtime-runes/samples/invalid-html-ssr/_config.js +++ b/packages/svelte/tests/runtime-runes/samples/invalid-html-ssr/_config.js @@ -16,6 +16,8 @@ export default test({ recover: true, + mode: ['hydrate'], + before_test() { console.error = (x) => { log.push(x); @@ -27,16 +29,18 @@ export default test({ log.length = 0; }, - async test({ assert, variant }) { - if (variant === 'hydrate') { - assert.equal( - log[0].split('\n')[0], - 'node_invalid_placement_ssr: `

` (main.svelte:6:0) cannot contain `

` (h1.svelte:1:0)' - ); - assert.equal( - log[1].split('\n')[0], - 'node_invalid_placement_ssr: `
` (main.svelte:9:0) cannot contain `` (form.svelte:1:0)' - ); - } - } + async test({ assert }) { + assert.equal( + log[0].split('\n')[0], + 'node_invalid_placement_ssr: `

` (main.svelte:6:0) cannot contain `

` (h1.svelte:1:0)' + ); + assert.equal( + log[1].split('\n')[0], + 'node_invalid_placement_ssr: `` (main.svelte:9:0) cannot contain `` (form.svelte:1:0)' + ); + }, + + warnings: [ + 'Hydration failed because the initial UI does not match what was rendered on the server' + ] });