@@ -11,7 +11,9 @@ with any testing framework and runner you're comfortable with.
1111
12121 . Install Jest and Babel
1313
14- ` npm install --save-dev jest babel-jest @babel/core @babel/preset-env `
14+ ```
15+ npm install --save-dev jest babel-jest @babel/core @babel/preset-env
16+ ```
1517
16182. Add the following to your `package.json`
1719
@@ -34,9 +36,11 @@ with any testing framework and runner you're comfortable with.
3436
35374. You'll need to compile the Svelte components before using them in Jest, so
3638 we need to install the [svelte-jest](https://github.com/ktsn/svelte-jest)
37- transformer.
39+ transformer
3840
39- `npm install --save-dev svelte-jest`
41+ ```
42+ npm install --save-dev svelte-jest
43+ ```
4044
41455. Add the following Jest configuration to your `package.json`
4246
@@ -45,7 +49,7 @@ with any testing framework and runner you're comfortable with.
4549 "jest": {
4650 "transform": {
4751 "^.+\\.js$": "babel-jest",
48- "^.+\\ .svelte$" : " jest-transform- svelte"
52+ "^.+\\.svelte$": "svelte-jest "
4953 },
5054 "moduleFileExtensions": ["js", "json", "svelte"]
5155 }
@@ -54,11 +58,13 @@ with any testing framework and runner you're comfortable with.
5458
55596. This is optional but it is recommended, you can install
5660 [jest-dom](https://github.com/testing-library/jest-dom) to add handy
57- assertions to Jest.
61+ assertions to Jest
5862
5963 6.1 Install jest-dom
6064
61- `npm install --save-dev @testing-library/jest-dom`
65+ ```
66+ npm install --save-dev @testing-library/jest-dom
67+ ```
6268
6369 6.2 Add the following to your Jest configuration in `package.json`
6470
@@ -69,6 +75,8 @@ with any testing framework and runner you're comfortable with.
6975 ```
7076
71777. Create your component + test file (checkout the rest of the docs to see how)
72- and run
78+ and run it
7379
74- `npm run test`
80+ ```
81+ npm run test
82+ ```
0 commit comments