Skip to content

Conversation

@metonym
Copy link
Collaborator

@metonym metonym commented Dec 1, 2025

Closes #2267

This library is intended to work with Svelte 3, 4, and 5 (non-runes mode). Currently, this library uses Svelte 4 to test and type-check the source code. It also uses Svelte 4 for the interactive demos in the docs.

This PR adds scaffolding to run the same testing with the latest Svelte 5 version.

Motivation

Changes

  • Add a minimal scaffold in tests-svelte5. This must be a separate package since mixing Svelte versions in the same package.json has not worked well (causes trouble for svelte-check, Vite plugin etc..)
  • Migrate existing tests to use the new Svelte Testing Library API (rerender instead of component.$set)
  • Flag Svelte 5 quirks (implying bugs that need addressing)
if (isSvelte5) {
  // Svelte 5 may emit check event multiple times
  expect(consoleLog.mock.calls.length).toBeGreaterThanOrEqual(2);
} else {
  expect(consoleLog).toHaveBeenCalledTimes(2);
}

@metonym metonym force-pushed the metonym/svelte-5-testing branch 3 times, most recently from 87bffd4 to 9916fe6 Compare December 1, 2025 06:06
@metonym metonym marked this pull request as ready for review December 1, 2025 14:23
@metonym metonym force-pushed the metonym/svelte-5-testing branch from adf054b to 5d95dfe Compare December 1, 2025 14:31
@metonym metonym merged commit 3f9acab into master Dec 1, 2025
8 checks passed
@metonym metonym deleted the metonym/svelte-5-testing branch December 1, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant