4 ms·
There’s svelte-testing-library [0] which follows the same approach as the React flavor. It emphasizes testing the app “as the user would use it”, which boils do
by dceddia 6y ago
There’s svelte-testing-library [0] which follows the same approach as the React flavor. It emphasizes testing the app “as the user would use it”, which boils down to rendering components and inspecting the DOM. They intentionally don’t give you visibility into the internal state of the component, which can be weird to get used to if you’re used to doing things like “click the button; assert that state isClicked became true”, but it tends to result in less brittle tests.
0: https://testing-library.com/docs/svelte-testing-library/intro/ https://testing-library.com/docs/svelte-testing-library/intr...
- Vinnl 6y agoThanks, that looks pretty good, and testing-library is excellent. I couldn't find it in the docs, but do you know how this "renders" the Svelte components - in memory using e.g. jsdom, or by firing up a full-fledged browser? (The former would be highly preferable.)