Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions docs/svelte-testing-library/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,36 @@ with any testing framework and runner you're comfortable with.
}
```

5. This is optional but it is recommended, you can install
5. If you are using ES6 modules in your project you have to add Jest's babel
transform setting (it is set by default, but since we are overriding the
transform config, we have to add it explicitly)

```json
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.svelte$": "svelte-jester"
},
```

6. This is optional but it is recommended, you can install
[jest-dom](https://github.com/testing-library/jest-dom) to add handy
assertions to Jest

5.1 Install jest-dom
6.1 Install jest-dom

```
npm install --save-dev @testing-library/jest-dom
```

5.2 Add the following to your Jest configuration in `package.json`
6.2 Add the following to your Jest configuration in `package.json`

```json
{
"setupFilesAfterEnv": ["@testing-library/jest-dom/extend-expect"]
}
```

6. Create your component + test file (checkout the rest of the docs to see how)
7. Create your component + test file (checkout the rest of the docs to see how)
and run it

```
Expand Down