1212
1313<p >Simple and complete Svelte testing utilities that encourage good testing practices.</p >
1414
15- [ ** Read The Docs** ] ( https://testing-library.com/docs/svelte-testing-library/intro ) |
16- [ Edit the docs] ( https://github.com/testing-library/testing-library-docs )
15+ [ ** Read The Docs** ] [ stl-docs ] | [ Edit the docs] [ stl-docs-repo ]
1716
1817<!-- prettier-ignore-start -->
1918[ ![ Build Status] [ build-badge ]] [ build ]
2019[ ![ Code Coverage] [ coverage-badge ]] [ coverage ]
21- [ ![ version] [ version-badge ]] [ package ] [ ![ downloads] [ downloads-badge ]] [ npmtrends ]
20+ [ ![ version] [ version-badge ]] [ package ]
21+ [ ![ downloads] [ downloads-badge ]] [ downloads ]
2222[ ![ MIT License] [ license-badge ]] [ license ]
2323
24- [ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square )] ( #contributors- )
25- [ ![ PRs Welcome] [ prs-badge ]] [ prs ] [ ![ Code of Conduct] [ coc-badge ]] [ coc ]
24+ [ ![ All Contributors] [ contributors-badge ]] [ contributors ]
25+ [ ![ PRs Welcome] [ prs-badge ]] [ prs ]
26+ [ ![ Code of Conduct] [ coc-badge ]] [ coc ]
2627[ ![ Discord] [ discord-badge ]] [ discord ]
2728
2829[ ![ Watch on GitHub] [ github-watch-badge ]] [ github-watch ]
3334
3435<hr />
3536
37+ [ stl-docs ] : https://testing-library.com/docs/svelte-testing-library/intro
38+ [ stl-docs-repo ] : https://github.com/testing-library/testing-library-docs
39+ [ build-badge ] : https://img.shields.io/github/actions/workflow/status/testing-library/svelte-testing-library/release.yml?style=flat-square
40+ [ build ] : https://github.com/testing-library/svelte-testing-library/actions
41+ [ coverage-badge ] : https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square
42+ [ coverage ] : https://codecov.io/github/testing-library/svelte-testing-library
43+ [ version-badge ] : https://img.shields.io/npm/v/@testing-library/svelte.svg?style=flat-square
44+ [ package ] : https://www.npmjs.com/package/@testing-library/svelte
45+ [ downloads-badge ] : https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
46+ [ downloads ] : http://www.npmtrends.com/@testing-library/svelte
47+ [ license-badge ] : https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b&style=flat-square
48+ [ license ] : https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
49+ [ contributors-badge ] : https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square
50+ [ contributors ] : #contributors
51+ [ prs-badge ] : https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
52+ [ prs ] : http://makeapullrequest.com
53+ [ coc-badge ] : https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
54+ [ coc ] : https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
55+ [ discord-badge ] : https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
56+ [ discord ] : https://discord.gg/testing-library
57+ [ github-watch-badge ] : https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
58+ [ github-watch ] : https://github.com/testing-library/svelte-testing-library/watchers
59+ [ github-star-badge ] : https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
60+ [ github-star ] : https://github.com/testing-library/svelte-testing-library/stargazers
61+ [ twitter ] : https://twitter.com/intent/tweet?text=Check%20out%20svelte-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fsvelte-testing-library%20%F0%9F%91%8D
62+ [ twitter-badge ] : https://img.shields.io/twitter/url/https/github.com/testing-library/svelte-testing-library.svg?style=social
63+
3664## Table of Contents
3765
3866<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4169- [ The Problem] ( #the-problem )
4270- [ This Solution] ( #this-solution )
4371- [ Installation] ( #installation )
72+ - [ Setup] ( #setup )
4473- [ Docs] ( #docs )
4574- [ Issues] ( #issues )
4675 - [ 🐛 Bugs] ( #-bugs )
4776 - [ 💡 Feature Requests] ( #-feature-requests )
4877 - [ ❓ Questions] ( #-questions )
4978- [ Contributors] ( #contributors )
50- - [ LICENSE] ( #license )
5179
5280<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5381
5482## The Problem
5583
56- You want to write tests for your Svelte components so that they avoid including implementation
57- details, and are maintainable in the long run.
84+ You want to write maintainable tests for your [ Svelte] [ svelte ] components.
85+
86+ [ svelte ] : https://svelte.dev/
5887
5988## This Solution
6089
61- The ` svelte- testing-library` is a very lightweight solution for testing Svelte
62- components. It provides light utility functions on top of ` svelte ` and
63- ` dom- testing-library` , in a way that encourages better testing practices. Its
64- primary guiding principle is:
90+ ` @ testing-library/svelte ` is a lightweight library for testing Svelte
91+ components. It provides functions on top of ` svelte ` and
92+ ` @ testing-library/dom ` so you can mount Svelte components and query their
93+ rendered output in the DOM. Its primary guiding principle is:
6594
6695> [ The more your tests resemble the way your software is used, the more
6796> confidence they can give you.] [ guiding-principle ]
6897
98+ [ guiding-principle ] : https://twitter.com/kentcdodds/status/977018512689455106
99+
69100## Installation
70101
71102This module is distributed via [ npm] [ npm ] which is bundled with [ node] [ node ] and
@@ -77,12 +108,18 @@ npm install --save-dev @testing-library/svelte
77108
78109This library supports ` svelte ` versions ` 3 ` , ` 4 ` , and ` 5 ` .
79110
80- You may also be interested in installing ` @testing-library/jest-dom ` so you can use
81- [ the custom jest matchers] ( https://github.com/testing-library/jest-dom ) .
111+ You may also be interested in installing ` @testing-library/jest-dom ` so you can
112+ use [ the custom jest matchers] [ jest-dom ] .
113+
114+ [ npm ] : https://www.npmjs.com/
115+ [ node ] : https://nodejs.org
116+ [ jest-dom ] : https://github.com/testing-library/jest-dom
82117
83118## Setup
84119
85- We recommend using ` @testing-library/svelte ` with [ Vitest] [ ] as your test runner. To get started, add the ` svelteTesting ` plugin to your Vite or Vitest config.
120+ We recommend using ` @testing-library/svelte ` with [ Vitest] [ ] as your test
121+ runner. To get started, add the ` svelteTesting ` plugin to your Vite or Vitest
122+ config.
86123
87124``` diff
88125 // vite.config.js
@@ -97,33 +134,40 @@ We recommend using `@testing-library/svelte` with [Vitest][] as your test runner
97134 });
98135```
99136
100- See the [ setup docs] [ ] for more detailed setup instructions, including for other test runners like Jest.
137+ See the [ setup docs] [ ] for more detailed setup instructions, including for other
138+ test runners like Jest.
101139
102140[ vitest ] : https://vitest.dev/
103141[ setup docs ] : https://testing-library.com/docs/svelte-testing-library/setup
104142
105143## Docs
106144
107- See the [ ** docs** ] ( https://testing-library.com/ docs/svelte-testing-library/intro ) over at the Testing Library website.
145+ See the [ ** docs** ] [ stl- docs] over at the Testing Library website.
108146
109147## Issues
110148
111149_ Looking to contribute? Look for the [ Good First Issue] [ good-first-issue ]
112150label._
113151
152+ [ good-first-issue ] : https://github.com/testing-library/svelte-testing-library/issues?utf8=✓&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"good+first+issue"+
153+
114154### 🐛 Bugs
115155
116156Please file an issue for bugs, missing documentation, or unexpected behavior.
117157
118158[ ** See Bugs** ] [ bugs ]
119159
160+ [ bugs ] : https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
161+
120162### 💡 Feature Requests
121163
122164Please file an issue to suggest new features. Vote on feature requests by adding
123165a 👍. This helps maintainers prioritize what to work on.
124166
125167[ ** See Feature Requests** ] [ requests ]
126168
169+ [ requests ] : https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
170+
127171### ❓ Questions
128172
129173For questions related to using the library, please visit a support community
@@ -132,6 +176,8 @@ instead of filing an issue on GitHub.
132176- [ Discord] [ discord ]
133177- [ Stack Overflow] [ stackoverflow ]
134178
179+ [ stackoverflow ] : https://stackoverflow.com/questions/tagged/svelte-testing-library
180+
135181## Contributors
136182
137183Thanks goes to these people ([ emoji key] [ emojis ] ):
@@ -173,44 +219,5 @@ Thanks goes to these people ([emoji key][emojis]):
173219This project follows the [ all-contributors] [ all-contributors ] specification.
174220Contributions of any kind welcome!
175221
176- ## LICENSE
177-
178- [ MIT] ( LICENSE )
179-
180- <!-- prettier-ignore-start -->
181-
182- [ npm ] : https://www.npmjs.com/
183- [ node ] : https://nodejs.org
184- [ build-badge ] : https://img.shields.io/github/actions/workflow/status/testing-library/svelte-testing-library/release.yml?style=flat-square
185- [ build ] : https://github.com/testing-library/svelte-testing-library/actions
186- [ coverage-badge ] : https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square
187- [ coverage ] : https://codecov.io/github/testing-library/svelte-testing-library
188- [ version-badge ] : https://img.shields.io/npm/v/@testing-library/svelte.svg?style=flat-square
189- [ package ] : https://www.npmjs.com/package/@testing-library/svelte
190- [ downloads-badge ] : https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
191- [ npmtrends ] : http://www.npmtrends.com/@testing-library/svelte
192- [ discord-badge ] : https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
193- [ discord ] : https://discord.gg/testing-library
194- [ license-badge ] : https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b&style=flat-square
195- [ license ] : https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
196- [ prs-badge ] : https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
197- [ prs ] : http://makeapullrequest.com
198- [ donate-badge ] : https://img.shields.io/badge/$-support-green.svg?style=flat-square
199- [ coc-badge ] : https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
200- [ coc ] : https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
201- [ github-watch-badge ] : https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
202- [ github-watch ] : https://github.com/testing-library/svelte-testing-library/watchers
203- [ github-star-badge ] : https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
204- [ github-star ] : https://github.com/testing-library/svelte-testing-library/stargazers
205- [ twitter ] : https://twitter.com/intent/tweet?text=Check%20out%20svelte-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fsvelte-testing-library%20%F0%9F%91%8D
206- [ twitter-badge ] : https://img.shields.io/twitter/url/https/github.com/testing-library/svelte-testing-library.svg?style=social
207222[ emojis ] : https://github.com/all-contributors/all-contributors#emoji-key
208223[ all-contributors ] : https://github.com/all-contributors/all-contributors
209- [ set-immediate ] : https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate
210- [ guiding-principle ] : https://twitter.com/kentcdodds/status/977018512689455106
211- [ bugs ] : https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
212- [ requests ] : https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
213- [ good-first-issue ] : https://github.com/testing-library/svelte-testing-library/issues?utf8=✓&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"good+first+issue"+
214- [ stackoverflow ] : https://stackoverflow.com/questions/tagged/svelte-testing-library
215-
216- <!-- prettier-ignore-end -->
0 commit comments