You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests
Philip Breuer b7bc1309aa
fix: preserve original boundary errors when keyed each rows are removed during async updates (#17843)
3 weeks ago
..
compiler-errors docs: flesh out `attribute_invalid_sequence_expression` message (#17789) 4 weeks ago
css perf: optimize CSS selector pruning (#17846) 3 weeks ago
hydration failing test (#12791) 2 months ago
manual/each-stress-test fix: destroy each items after siblings are resumed (#17258) 4 months ago
migrate fix: `print()` multiline behaviour (#17319) 2 months ago
motion feat: allow non-numeric values to be tweened by snapping immediately to new value (#14941) 1 year ago
parser-legacy feat: allow comments in tags (#17671) 1 month ago
parser-modern feat: allow comments in tags (#17671) 1 month ago
preprocess chore: switch to `tinyglobby` (#15388) 1 year ago
print fix: follow-up formatting in `print()` for block-level elements (#17699) 1 month ago
runtime-browser fix: merge consecutive text nodes during hydration for large text content (#17587) 2 months ago
runtime-legacy feat: allow error boundaries to work on the server (#17672) 1 month ago
runtime-production fix: emit `each_key_duplicate` error in production (#16724) 2 months ago
runtime-runes fix: preserve original boundary errors when keyed each rows are removed during async updates (#17843) 3 weeks ago
runtime-xhtml fix: take into account `nodeName` case sensitivity on XHTML pages (#17689) 1 month ago
server-side-rendering fix: always case insensitive event handlers during ssr (#17822) 3 weeks ago
signals fix: use "set up" (verb) instead of "setup" (noun) in comments (#17632) 1 month ago
snapshot fix: correctly add `__svelte_meta` after else-if chains (#17830) 3 weeks ago
sourcemaps fix: correct spelling errors in test files (#17630) 1 month ago
store feat: allow `await` in components (#15844) 8 months ago
types feat: type `currentTarget` in `on` function (#17370) 3 months ago
validator Warn on non-destructured `$props()` reads in runes mode (#17708) 1 month ago
.gitignore breaking: init Svelte 5 2 years ago
README.md fix typo (#17347) 3 months ago
animation-helpers.js chore:Update for TS7 (#16485) 8 months ago
css-parse.test.ts chore: provide proper public type for `parseCss` result (#17654) 1 month ago
helpers.js fix: less confusing names for inspect errors (#17026) 5 months ago
html_equal.js chore: add xhtml tests (#17597) 1 month ago
suite.ts chore: allow testing in production env 2 (#17590) 2 months ago

README.md

Test repo

This repo tries to migrate as many tests from the current Svelte project over to test against the new compiler/runtime.

Differences to the old test suite

  • compiler options are different currently, a wrapper function in helpers.js was added and call sites rerouted to that
  • regex in the loader was adjusted, a $ was added to the import * as .. regex (because the new runtime does import * as $ from .. for the runtime)
  • vitest.config.js was altered: resolve-svelte plugin also aliases svelte (the current runtime import) and test.dir was adjusted because the monorepo structure is different (compiler/runtime are separate packages here currently)
  • new runtime does not expose things like raf etc, which were used in some tests (runtime for example; for transition/animation tests). These are commented out for now
  • when changing an attribute, the JSDOM does not reflect the value immediately anymore because the runtime does update the DOM in after a tick, not synchronously - this results in many tests needing additional await Promise.resolve() lines

Breaking changes

  • Order of list insertions has changed: It's now back to front because that's faster
  • Slight timing differences mean that things may fire less in some cases (behavior should be unaffected though) - see component-binding-each-remount-unkeyed for an example
  • It's currently possible to create infinite loops with $: invoking each other
  • Fallback value is now set on all undefined values, not just on the first one
  • CSS is no longer minified. Unused styles are instead commented out
  • :global(...) compound selectors (e.g. .foo:global(.bar) or :global(.foo).bar) are no longer permitted. These are nonsensical and don't do anything useful in Svelte 4 — better to just get rid of them
  • transitions: when one element fades out and a new one (which is on the same element but another instance of it) fades in at the same time, the new one is now below the old one (was above before)
  • transitions: now wait one tick before they start playing to align with web animations API

TODOs

  • the new runtime does not expose named exports such as svelte/store yet, so can't test those
  • event this context is not preserved due to event delegation etc. Problem? Or necessary/ok breaking change?
  • order of operations should be preserved: first all attribute setters (spread props, static props) in order, then mutation directives (actions, bindings) in order, then style/class directives in order

Tests that succeeded but need a closer look

  • $$slot was modified to succeed, see TODOs inside for more info
  • await-component-oncreate needs to await Promise.resolve() because onMount runs async, too. Is this ok?
  • component-slot-fallback-2 has one check commented out, because store subscriptions are deduplicated at the runtime level now. Should this be seen as a breaking change? If yes, ok?

Tests that are not copied over yet

  • everything except runtime is missing so far
  • animation tests within runtime folder were not copied over
  • beforeUpdate/afterUpdate tests