Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
sveltekit-uvu-testing
SvelteKit uvu testing: how you can easily add fast component and utility function unit tests to your Svelte app using uvu with TypeScript.
Vistest is another new test runner, which can be used in a similar way to uvu. I have seen a set of tests which suggest uvu runs faster than Vitest. Both tools are under development so if speed is critical for your project it is worth running benchmarks using latest versions on your own code base.
We’re using the Svelte example from the uvu repo as a guide here. In addition to that, we also have some config based on the basf/svelte-spectre project. If your project does not already have a tests folder create one now in the project root. Next, create a setup directory with tests and add these four files:
Most important here is not to forget to include test.run() at the end… I’ve done that a few times 😅. Notice how we are able to use aliases in lines 1–3. You can see the full range of assert methods available in the uvu docs.
You can see an example project with all of this setup and config on the Rodney Lab Git Hub repo. You can drop a comment below or reach for a chat on Element as well as Twitter @mention if you have suggestions for improvements or questions.