5 ms·
I loved Svelte a few years back and still think it's a nice framework with cool ideas. However, a big issue for me using it at a company is that testing (espec
by gedy 7y ago
I loved Svelte a few years back and still think it's a nice framework with cool ideas. However, a big issue for me using it at a company is that testing (especially unit testing) seems to be an afterthought. This has made it a non-starter for using it with multiple teams working on same code base. Maybe it's changed with Svelte 3 but a library I wrote for it wasn't clear how to test.
(Edit sounds same:
https://github.com/sveltejs/svelte/wiki/FAQ#how-do-i-do-testing-svelte-apps https://github.com/sveltejs/svelte/wiki/FAQ#how-do-i-do-test...)
JS libraries sometimes take a non-presciptive approach of "test however you want!", But roll your own testing for a UI framework really limits adoption and enthusiasm at larger companies.
- tobr 7y agoDid you look at svelte-testing-library[1]? It looks like a good option to me, but I haven’t tried it. 1: https://github.com/testing-library/svelte-testing-library https://github.com/testing-library/svelte-testing-library
- gedy 7y agoAh that looks nice, will try it out, thank you!
- rich_harris 7y agoHonestly, the biggest blocker to us having a 'blessed' story around testing isn't figuring out how to test (which is relatively straightforward), it's figuring out what to test. Do you really need to test that `<p>Hello {name}!</p>` results in `<p>Hello world!</p>` if `name = world`? Because then you're really just testing that the framework itself isn't buggy, rather than anything to do with your app. Which isn't to dismiss the concern — just to offer an explanation as to why it hasn't been our top priority so far.
- gedy 7y ago> "Because then you're really just testing that the framework itself isn't buggy" Not in all cases, I maintain some component libraries (mostly React, but a Svelte one too) and ensuring a standard component interface is pretty valuable imho. Enzyme as an example lets you test React components, props, state, etc in isolation but is not very prescriptive about what you 'should' test.
- lucisferre 7y agoIs there any UI framework where testing isn't an afterthought?
- wishinghand 7y agoI never used it but I remember Angular coming with unit and e2e testing.
- gedy 7y agoReact at least had ReactTestUtils 'officially' and then recommended ReactTestingLibrary & Enzyme as the ecosystem matured: https://reactjs.org/docs/test-utils.html https://reactjs.org/docs/test-utils.html
- no_wizard 7y agoAngular really shines here, I feel. I really like protractor, and you can integrate it really easy with puppeteer (via expect-puppeteer or karma-chrome-launder with the option headless)