You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
5.2 import `@testing-library/jest-dom` at the start of your test files
64
+
4. Optionally install [vitest-dom](https://github.com/chaance/vitest-dom) to add
65
+
handy assertions to Vitest
65
66
66
-
```js
67
-
import'@testing-library/jest-dom';
68
-
```
67
+
5.1 Install `vitest-dom`
69
68
70
-
6. Create your component and a test file (checkout the rest of the docs to see how)
71
-
and run the following command to run the tests.
69
+
```bash npm2yarn
70
+
npm install --save-dev vitest-dom
71
+
```
72
72
73
-
```
74
-
npm run test
75
-
```
76
-
### SvelteKit
73
+
5.2 import `vitest-dom` at within the vitest setup file (usually `vitest-setup.(js|ts)`)
74
+
75
+
```js
76
+
import*asmatchersfrom"vitest-dom/matchers";
77
+
import { expect } from"vitest";
78
+
expect.extend(matchers);
79
+
80
+
// or:
81
+
import"vitest-dom/extend-expect";
82
+
```
77
83
78
-
To use Vitest with SvelteKit install `vitest-svelte-kit`, which includes a preconfigured Vitest configuration for SvelteKit projects.
79
-
You can take a look at the [`vitest-svelte-kit` configuration docs](https://github.com/nickbreaton/vitest-svelte-kit/tree/master/packages/vitest-svelte-kit#configuring) for further instructions.
84
+
5. Create your component and a test file (checkout the rest of the docs to see
85
+
how) and run the following command to run the tests.
86
+
87
+
```bash npm2yarn
88
+
npm run test
89
+
```
80
90
81
91
## Jest
82
92
83
93
1. Install Jest & jest-environment-jsdom
84
94
85
-
```
95
+
```bash npm2yarn
86
96
npm install --save-dev jest jest-environment-jsdom
87
97
```
88
98
@@ -173,8 +183,8 @@ You can take a look at the [`vitest-svelte-kit` configuration docs](https://gith
173
183
174
184
### TypeScript
175
185
176
-
To use TypeScript with Jest, you'll need to install and configure`svelte-preprocess` and
177
-
`ts-jest`. For full instructions, see the
186
+
To use TypeScript with Jest, you'll need to install and configure
187
+
`svelte-preprocess` and `ts-jest`. For full instructions, see the
0 commit comments