Skip to content

Commit f0bc9ed

Browse files
benmonroBen Monro
authored and
Kent C. Dodds
committed
updated package name for svelte (#106)
* Create intro.md * doc: added testcafe-testing-library docs * doc: cleaned up some little details * added note for container * add docs for within * added svelte & known issue w/ testcafe * added note about jest-transform-svelte * removed old example * added logos to home page * added cleanup section * reverted old image name Co-authored-by: Ben Monro <ben.monro@pwc.com>
1 parent f23d0c3 commit f0bc9ed

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

docs/svelte-testing-library/intro.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Svelte Testing Library
77
[Svelte](https://svelte.dev/) components & applications.
88

99
```
10-
npm install --save-dev svlt-testing-library
10+
npm install --save-dev svelte-testing-library
1111
```
1212

1313
- [svelte-testing-library on GitHub][gh]
@@ -21,7 +21,7 @@ order to use svelte in jest.
2121
You must add `cleanup` to your test fixture's `beforeEach` hook:
2222

2323
```javascript
24-
import { render, cleanup } from 'svlt-testing-library'
24+
import { render, cleanup } from 'svelte-testing-library'
2525

2626
beforeEach(cleanup) //this is required.
2727
```
@@ -48,7 +48,7 @@ App.spec.js
4848

4949
```javascript
5050
import App from '../src/App.svelte'
51-
import { render, cleanup } from 'svlt-testing-library'
51+
import { render, cleanup } from 'svelte-testing-library'
5252
beforeEach(cleanup)
5353
describe('App', () => {
5454
test('should render greeting', () => {
@@ -69,4 +69,24 @@ describe('App', () => {
6969
})
7070
```
7171

72+
### Cleanup
73+
74+
You can ensure [`cleanup`](./api#cleanup) is called after each test and import
75+
additional assertions by adding it to the setup configuration in Jest.
76+
77+
In Jest 24 and up, add the
78+
[`setupFilesAfterEnv`](https://jestjs.io/docs/en/configuration.html#setupfilesafterenv-array)
79+
option to your Jest config:
80+
81+
```javascript
82+
// jest.config.js
83+
module.exports = {
84+
setupFilesAfterEnv: [
85+
'svelte-testing-library/cleanup-after-each',
86+
// ... other setup files ...
87+
],
88+
// ... other options ...
89+
}
90+
```
91+
7292
[gh]: https://github.com/testing-library/svelte-testing-library

website/static/img/svelte-128x128.png

-16.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)