# Testing signals — sveltejs/svelte

> Canonical page: https://codevetter.com/unpack/svelte/testing-signals

# Testing signals — sveltejs/svelte

Scanned commit 636eaaaa6f064b55072e7d192bb76dc9d8c4516e (2026-09-18). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Testing is Vitest-driven with a fixture-directory convention: 22 suites under `packages/svelte/tests/`, each a `test.ts` plus a `samples/` directory where every subdirectory is one test, optionally configured by a `_config.js`. Coverage is enormous by fixture count — 1,209 legacy runtime samples, 1,054 runes runtime samples, 335 validator samples, 184 CSS samples — and the runtime suites multiply each by four variants (dom, hydrate, ssr, async-ssr). Real-browser coverage is narrow: only `runtime-browser` (35 samples) and the custom-elements samples run under Playwright Chromium. CI runs the full suite on Node 20/22/24 across Windows, macOS, and Ubuntu, plus a no-async pass, a tsgo typecheck, a lint/types-drift gate, and a benchmark job.
- Vitest 4 is the single test runner, configured once at the repo root with `include` patterns `packages/svelte/**/*.test.ts`, `packages/svelte/tests/*/test.ts`, and `packages/svelte/tests/runtime-browser/test-ssr.ts`, and `**/samples/**` excluded so fixtures are never collected as tests. — [vitest.config.js#L28-45](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/vitest.config.js#L28-L45) [package.json](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/package.json)
- The global `testTimeout` is raised to 30s with an in-file rationale: dev-mode tests that trip `effect_update_depth_exceeded` allocate ~1000 Error objects per flush for stack tracking, which overruns the 5s default under Vitest 4. — [vitest.config.js#L30-36](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/vitest.config.js#L30-L36)
- `tests/suite.ts` provides the two harness primitives: `suite()` (one `it` per sample dir) and `suite_with_variants()` (one `it` per dir × variant, with a `should_skip_variant` hook returning `true` to skip or `'no-test'` to omit entirely). — [packages/svelte/tests/suite.ts#L27-72](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/suite.ts#L27-L72)
- Test selection supports both `pnpm test <suite> -t <name>` and a `FILTER` env var that compiles to an anchored or `/regex/` RegExp in `suite.ts`, plus per-config `skip`/`solo`/`timeout` flags on `BaseTest`. — [packages/svelte/tests/suite.ts#L10-25](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/suite.ts#L10-L25) [CONTRIBUTING.md#L96-116](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/CONTRIBUTING.md#L96-L116)
- Runtime suites run four variants per sample — `dom`, `hydrate`, `ssr`, `async-ssr` — with `async-ssr` gated on both runes mode and `async_mode` (i.e. `process.env.SVELTE_NO_ASYNC !== 'true'`). — [packages/svelte/tests/runtime-legacy/shared.ts#L176-236](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/runtime-legacy/shared.ts#L176-L236) [packages/svelte/tests/helpers.js#L196-198](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/helpers.js#L196-L198)
- Fixture counts skew heavily toward runtime behaviour: `runtime-legacy/samples` (1209), `runtime-runes/samples` (1054), `validator/samples` (335), `css/samples` (184), `compiler-errors/samples` (146), `server-side-rendering/samples` (132). — [packages/svelte/tests/runtime-legacy/test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/runtime-legacy/test.ts) [packages/svelte/tests/runtime-runes/test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/runtime-runes/test.ts) [packages/svelte/tests/validator/test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/validator/test.ts)
- Real-browser testing is limited to `tests/runtime-browser/test.ts`, which launches a single Chromium via `@playwright/test`, bundles each sample with `esbuild`, and runs `dom`/`hydrate` variants plus a separate `custom-elements-samples` suite — with `retry: 1` on CI because 'browser tests are brittle and slow on CI'. — [packages/svelte/tests/runtime-browser/test.ts#L1-60](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/runtime-browser/test.ts#L1-L60)
- XHTML/XML-document behaviour gets its own environment: `vitest-xhtml-environment.ts` wraps the jsdom builtin with `contentType: 'application/xhtml+xml'`, consumed by `tests/runtime-xhtml/test.ts` via a `@vitest-environment` pragma (13 samples). — [vitest-xhtml-environment.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/vitest-xhtml-environment.ts) [packages/svelte/tests/runtime-xhtml/test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/runtime-xhtml/test.ts)
- Unit tests colocated with source are rare — only `src/utils.test.ts`, `src/internal/client/proxy.test.ts`, `src/internal/client/error-handling.test.ts`, the four `src/reactivity/*.test.ts` files, and `src/internal/server/{crypto,hydratable,renderer}.test.ts`. — [packages/svelte/src/internal/client/proxy.test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/src/internal/client/proxy.test.ts) [packages/svelte/src/internal/server/renderer.test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/src/internal/server/renderer.test.ts) [packages/svelte/src/reactivity/map.test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/src/reactivity/map.test.ts)
- Snapshot-style suites (`snapshot`, `parser-modern`, `parser-legacy`, `print`, `sourcemaps`) assert generated output against checked-in expectations and are regenerated with `UPDATE_SNAPSHOTS=true pnpm test`. — [CONTRIBUTING.md#L118-122](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/CONTRIBUTING.md#L118-L122) [packages/svelte/tests/snapshot/test.ts](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/snapshot/test.ts)
- CI's `Tests` job matrixes Node 20 across windows/macOS/ubuntu plus Node 22 and 24 on ubuntu, installs only Chromium (`PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'` then `pnpm playwright install chromium`), with a 15-minute timeout. — [.github/workflows/ci.yml#L10-45](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/.github/workflows/ci.yml#L10-L45)
- A dedicated `TestNoAsync` job re-runs only `runtime-runes` with `SVELTE_NO_ASYNC: true`, guarding the non-async code path that the default run never exercises. — [.github/workflows/ci.yml#L46-62](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/.github/workflows/ci.yml#L46-L62)
- The `Lint` job doubles as a drift gate: after `pnpm build` it fails if `git status --porcelain` is non-empty (generated types out of date) and separately checks `documentation/docs/07-misc/.generated/` for a stale browser-support page. — [.github/workflows/ci.yml#L78-100](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/.github/workflows/ci.yml#L78-L100)
- Coverage is configured (v8 provider, `lcov` + `html`, scoped to `packages/svelte/src/**`, `reportOnFailure: true`) but no CI job invokes it or enforces a threshold. — [vitest.config.js#L45-53](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/vitest.config.js#L45-L53) [.github/workflows/ci.yml](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/.github/workflows/ci.yml)
- `tests/manual/` exists as a suite directory with no `test.ts` and no samples, so nothing in it runs under `pnpm test`. (inferred) — [packages/svelte/tests/manual](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/packages/svelte/tests/manual) [vitest.config.js#L37-42](https://github.com/sveltejs/svelte/blob/636eaaaa6f064b55072e7d192bb76dc9d8c4516e/vitest.config.js#L37-L42)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
