Skip to content

Commit 657fc18

Browse files
committed
docs: add links to new CLI add-on documentation
1 parent 6915c12 commit 657fc18

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

documentation/docs/07-misc/02-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Testing helps you write and maintain your code and guard against regressions. Te
66

77
## Unit and integration testing using Vitest
88

9-
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/).
9+
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/). When creating a new project with the Svelte CLI, you will be asked if you want to [setup Vitest](/docs/cli/vitest). Alternatively, you can add Vitest to an existing project with `npx sv vitest`.
1010

11-
To get started, install Vitest:
11+
To setup Vitest manually, first install it:
1212

1313
```bash
1414
npm install -D vitest
@@ -254,9 +254,9 @@ When writing component tests that involve two-way bindings, context or snippet p
254254

255255
E2E (short for 'end to end') tests allow you to test your full application through the eyes of the user. This section uses [Playwright](https://playwright.dev/) as an example, but you can also use other solutions like [Cypress](https://www.cypress.io/) or [NightwatchJS](https://nightwatchjs.org/).
256256

257-
To get started with Playwright, either install it via [the VS Code extension](https://playwright.dev/docs/getting-started-vscode), or install it from the command line using `npm init playwright`. It is also part of the setup CLI when you run `npx sv create`.
257+
If you create a new project with the Svelte CLI by running `npx sv create` you will be asked if you want to [setup Playwright](/docs/cli/playwright). You can also add it later on with `npx sv add playwright`. You can also [set it up with `npm init playwright`](https://playwright.dev/docs/intro). Additionally, you may also want to install an IDE plugin such as [the VS Code extension](https://playwright.dev/docs/getting-started-vscode) to be able to execute tests from inside your IDE.
258258

259-
After you've done that, you should have a `tests` folder and a Playwright config. You may need to adjust that config to tell Playwright what to do before running the tests - mainly starting your application at a certain port:
259+
If you've run `npm init playwright` or are not using Vite, you may need to adjust the Playwright config to tell Playwright what to do before running the tests - mainly starting your application at a certain port. For example:
260260

261261
```js
262262
/// file: playwright.config.js

0 commit comments

Comments
 (0)