SvelteKit uvu Testing: Fast Component Unit Tests

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • test-runner-compare

    JavaScript Test Runner Comparison(Jest, AVA, Mocha, tape, Jasmine, uvu, vitest)

  • 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.

  • svelte-spectre

    UI-kit based on *spectre.css* and powered by *svelte*

  • 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:

  • 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.

    SurveyJS logo
  • uvu

    uvu is an extremely fast and lightweight test runner for Node.js and the browser

  • 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.

  • 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.

  • 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.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts