Merge branch 'testing-docs' of github.com:sveltejs/svelte into testing-docs

pull/12600/head
Rich Harris 2 years ago
commit da5571de3a

@ -2,13 +2,13 @@
title: Testing title: Testing
--- ---
Testing helps you write and maintain your code and guard against regressions. Testing frameworks help you with that, allowing you to describe assertions or expectations about how your code should behave. Svelte is unopinionated about which testing framework you use, so you can write unit tests, integration tests, and end-to-end tests using solutions like Vitest, Jasmine, Cypress and Playwright. Testing helps you write and maintain your code and guard against regressions. Testing frameworks help you with that, allowing you to describe assertions or expectations about how your code should behave. Svelte is unopinionated about which testing framework you use you can write unit tests, integration tests, and end-to-end tests using solutions like Vitest, Jasmine, Cypress and Playwright.
## Unit/Integration tests using Vitest ## Unit and integration testing using Vitest
Unit tests allow you to test small isolated parts of your code. Integration tests allow you to test parts of your application to see if they work together. If you're using Vite (including via SvelteKit), we recommend using [Vitest](https://vitest.dev/). Unit tests allow you to test small isolated parts of your code. Integration tests allow you to test parts of your application to see if they work together. If you're using Vite (including via SvelteKit), we recommend using [Vitest](https://vitest.dev/).
To get started, install Vitest and JSDOM (a library that shims DOM APIs): To get started, install Vitest and jsdom (a library that shims DOM APIs):
```bash ```bash
npm install -D vitest jsdom npm install -D vitest jsdom

Loading…
Cancel
Save