This guide is for AI coding agents working in the Svelte monorepo.
Important: Read and follow CONTRIBUTING.md as well - it contains essential information about testing, code structure, and contribution guidelines that applies here.
When submitting a PR, you MUST read PULL_REQUEST_TEMPLATE.md and fill it out correctly. DO NOT submit a PR without running the full test suite.
See https://github.com/sveltejs/svelte/security/policy.
If asked to do a performance investigation, use the performance-investigation skill.
Most commonly, new tests will go in the runtime-runes suite. Observe the conventions established by existing tests, but don't be beholden to them — a lot of mistakes were made while building the test suite. In particular:
- prefer
<script lang="ts"> - try to put everything in a single
main.sveltefile unless you are specifically testing cross-module or child component behaviour, so the test is more portable. - Avoid using
propsunless necessary, and use buttons and inputs to change state rather than component exports - put the expected contents in an
<output>element, get a reference to it withconst [output] = target.querySelectorAll('output')(unlikequerySelector, this tricks TypeScript into believing it exists, without non-null assertions). You can thenassert.htmlEqual(output.innerHTML, ...)without having to include all the buttons etc