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
Simon H 9dc2d71a12
fix: relax constraint for ComponentProps (#12026)
1 year ago
..
compiler-errors fix: improve consttag ordering in non-runes mode (#11908) 1 year ago
css fix: allow global next to `&` for nesting (#11784) 1 year ago
hydration chore: cleanup more tests (#11738) 1 year ago
migrate fix: robustify migration script (#12019) 1 year ago
motion fix: correctly update tweened store initialized with nullish value (#10356) 2 years ago
parser-legacy fix: correctly backport `svelte:element` to old AST (#11917) 1 year ago
parser-modern chore: refactor logic for ignoring warnings (#11300) 1 year ago
preprocess fix: tweak script/style tag parsing/preprocessing logic (#9502) 2 years ago
runtime-browser feat: better dynamic component css props (#11792) 1 year ago
runtime-legacy fix: SSR template escaping (#12007) 1 year ago
runtime-runes fix: better event delegation behavior around multiple listeners (#12024) 1 year ago
server-side-rendering chore: simpler `<svelte:element>` hydration (#11773) 1 year ago
signals feat: detach inert effects (#11955) 1 year ago
snapshot feat: more efficient output for attributes in SSR (#11949) 1 year ago
sourcemaps fix: replicate Svelte 4 props update detection in legacy mode (#11577) 1 year ago
store fix: adjust order of `derived` function definition overloads (#11426) 1 year ago
types fix: relax constraint for ComponentProps (#12026) 1 year ago
validator feat: sort possible bindings in invalid binding error (#11950) 1 year ago
.gitignore breaking: init Svelte 5 2 years ago
README.md docs: note more breaking changes 2 years ago
animation-helpers.js fix: ensure transition errors are not swallowed (#11039) 1 year ago
helpers.js chore: css unused selector warnings (#11098) 1 year ago
html_equal.js chore: update noscript test (#11749) 1 year ago
suite.ts chore: ignore test directories left over from other branches (#10525) 2 years ago

README.md

Test repo

This repo tries to migrate as many tests from the currente 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