Skip to content

Commit 02280ab

Browse files
committed
docs(svelte): fix setup guide
1 parent f377786 commit 02280ab

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

docs/svelte-testing-library/setup.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ with any testing framework and runner you're comfortable with.
1111

1212
1. 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
1618
2. Add the following to your `package.json`
1719
@@ -34,9 +36,11 @@ with any testing framework and runner you're comfortable with.
3436
3537
4. 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
4145
5. 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
5559
6. 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
7177
7. 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

Comments
 (0)