failing test

elliott/boundary-issues
S. Elliott Johnson 11 months ago
parent d92fa432d1
commit 98bd5270f0

@ -0,0 +1,14 @@
import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
test({ assert, target, logs }) {
let btn = target.querySelector('button');
btn?.click();
btn?.click();
flushSync();
assert.deepEqual(logs, ['error caught 1', 'error caught 2']);
}
});

@ -0,0 +1,7 @@
<script lang="ts">
import Test from './test.svelte';
</script>
<svelte:boundary onerror={(e) => {console.log(e.stack)}}>
<Test />
</svelte:boundary>

@ -0,0 +1,22 @@
<script>
let count = $state(0);
let test = $derived.by(() => {
if (count > 1) {
throw new Error('test');
}
});
</script>
<svelte:boundary onerror={(e) => {console.log('error caught 1')}}>
<div>Count: {count}</div>
<button onclick={() => count++}>Increment</button>
{count} / {test}
</svelte:boundary>
<svelte:boundary onerror={(e) => {console.log('error caught 2')}}>
<div>Count: {count}</div>
<button onclick={() => count++}>Increment</button>
{count} / {test}
</svelte:boundary>
Loading…
Cancel
Save