-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Summary
Automated tests in src/testRenderMods.ts and src/testRender.ts (and potentially other render tests) fail to detect when a component crashes and is caught by a <svelte:boundary>. Currently, a test will pass even if the page displays an "Error" heading, provided it doesn't contain specific strings like undefined. Additionally, Svelte's internal console.error logs for structural issues (like each_key_duplicate) do not trigger test failures.
Context
- Test Code:
src/testRenderMods.ts - Error Handling:
src/Thing.svelteuses<svelte:boundary>which renders an.errorblock with "Error" text when a child component fails. - Svelte Runtime: Svelte 5 logs many critical rendering issues directly to
console.error.
Impact
- CI/CD Blindness: Regressions that cause certain items to fail rendering are not caught in CI if they trigger the error boundary or just log to the console.
- False Positives: Tests pass while the UI is broken for the user.
Severity
High. This affects the reliability of the entire automated test suite.
Steps to reproduce
- Run
pnpm vitest run src/__mod_tests__/mod.no_global_uniques.test.ts. - Observe that the test passes despite the output showing
Svelte error: each_key_duplicate. - Manually verify that the component is rendered as an "Error" block via the Svelte boundary if you were to look at the DOM output.
Tech details
Two specific improvements are needed:
- Assertion for Error Boundary: The
renderCaseintestRenderMods.tsshould explicitly check that the rendered output does NOT contain the "Error" text or specific error boundary markers. - Console Error Interception: Configure the test environment (e.g., in
src/test-setup.ts) to interceptconsole.error. Any call toconsole.error(especially those originating from Svelte's runtime) should fail the current test context.
Acceptance criteria
pnpm vitest run src/__mod_tests__/mod.no_global_uniques.test.ts(and any other test hitting a rendering crash) fails explicitly.- The failure message clearly indicates if it's due to a
console.erroror hitting an UI error boundary.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels