Skip to content

Commit 03bac7b

Browse files
author
Ben Monro
committed
fix: update readme
1 parent c2ccb27 commit 03bac7b

File tree

1 file changed

+233
-5
lines changed

1 file changed

+233
-5
lines changed

README.md

Lines changed: 233 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,97 @@
1-
### svelte-testing-library
1+
<div align="center">
2+
<h1>svelte-testing-library</h1>
23

3-
**_WIP_**
4+
<a href="https://www.emojione.com/emoji/1f410">
5+
<img
6+
height="80"
7+
width="80"
8+
alt="chipmunk"
9+
src="https://raw.githubusercontent.com/testing-library/svelte-testing-library/master/other/chipmunk.png"
10+
/>
11+
</a>
412

5-
## Installation
13+
<p>Simple and complete Svelte testing utilities that encourage good testing
14+
practices.</p>
15+
16+
<br />
17+
18+
[**Read The Docs**](https://testing-library.com/svelte) |
19+
[Edit the docs](https://github.com/alexkrolick/testing-library-docs)
20+
21+
<br />
22+
</div>
23+
24+
<hr />
25+
26+
<!-- prettier-ignore-start -->
27+
[![Build Status][build-badge]][build]
28+
[![Code Coverage][coverage-badge]][coverage]
29+
[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends]
30+
[![MIT License][license-badge]][license]
31+
32+
[![All Contributors](https://img.shields.io/badge/all_contributors-79-orange.svg?style=flat-square)](#contributors)
33+
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]
34+
[![Join the community on Spectrum][spectrum-badge]][spectrum]
35+
36+
[![Watch on GitHub][github-watch-badge]][github-watch]
37+
[![Star on GitHub][github-star-badge]][github-star]
38+
[![Tweet][twitter-badge]][twitter]
39+
<!-- prettier-ignore-end -->
40+
41+
<div align="center">
42+
<a href="https://testingjavascript.com">
43+
<img
44+
width="500"
45+
alt="TestingJavaScript.com Learn the smart, efficient way to test any JavaScript application."
46+
src="https://raw.githubusercontent.com/testing-library/svelte-testing-library/master/other/testingjavascript.jpg"
47+
/>
48+
</a>
49+
</div>
50+
51+
## Table of Contents
52+
53+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
54+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
55+
56+
- [The problem](#the-problem)
57+
- [This solution](#this-solution)
58+
- [Example](#example)
59+
- [Installation](#installation)
60+
- [Examples](#examples)
61+
- [Hooks](#hooks)
62+
- [Other Solutions](#other-solutions)
63+
- [Guiding Principles](#guiding-principles)
64+
- [Contributors](#contributors)
65+
- [Docs](#docs)
66+
- [Issues](#issues)
67+
- [🐛 Bugs](#-bugs)
68+
- [💡 Feature Requests](#-feature-requests)
69+
- [❓ Questions](#-questions)
70+
- [LICENSE](#license)
71+
72+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
73+
74+
## The problem
75+
76+
You want to write maintainable tests for your Svelte components. As a part of
77+
this goal, you want your tests to avoid including implementation details of your
78+
components and rather focus on making your tests give you the confidence for
79+
which they are intended. As part of this, you want your testbase to be
80+
maintainable in the long run so refactors of your components (changes to
81+
implementation but not functionality) don't break your tests and slow you and
82+
your team down.
83+
84+
## This solution
85+
86+
The `svelte-testing-library` is a very lightweight solution for testing Svelte
87+
components. It provides light utility functions on top of `svelte` and
88+
`dom-testing-library`, in a way that encourages better testing practices. Its
89+
primary guiding principle is:
690

7-
`npm i -D svlt-testing-library`
91+
> [The more your tests resemble the way your software is used, the more
92+
> confidence they can give you.][guiding-principle]
893
9-
## Usage
94+
## Example
1095

1196
App.svelte
1297

@@ -47,3 +132,146 @@ describe('App', () => {
47132
})
48133
})
49134
```
135+
136+
## Installation
137+
138+
This module is distributed via [npm][npm] which is bundled with [node][node] and
139+
should be installed as one of your project's `devDependencies`:
140+
141+
```
142+
npm install --save-dev svlt-testing-library
143+
```
144+
145+
This library has `peerDependencies` listings for `svelte`.
146+
147+
You may also be interested in installing `jest-dom` so you can use
148+
[the custom jest matchers](https://github.com/gnapse/jest-dom#readme).
149+
150+
> [**Docs**](https://testing-library.com/docs/svelte-testing-library/intro)
151+
152+
## Examples
153+
154+
> We're in the process of moving examples to the
155+
> [docs site](https://testing-library.com/docs/example-codesandbox)
156+
157+
158+
You can also find svelte-testing-library examples at
159+
[react-testing-examples.com](https://react-testing-examples.com/jest-rtl/).
160+
161+
162+
## Other Solutions
163+
164+
There's currently a package published in npm called `svelte-testing-library` but the git repository is not yet public. We are hoping to pull that work (and name) into this repository.
165+
166+
## Guiding Principles
167+
168+
> [The more your tests resemble the way your software is used, the more
169+
> confidence they can give you.][guiding-principle]
170+
171+
We try to only expose methods and utilities that encourage you to write tests
172+
that closely resemble how your svelte components are used.
173+
174+
Utilities are included in this project based on the following guiding
175+
principles:
176+
177+
1. If it relates to rendering components, it deals with DOM nodes rather than
178+
component instances, nor should it encourage dealing with component
179+
instances.
180+
2. It should be generally useful for testing individual Svelte components or
181+
full Svelte applications.
182+
3. Utility implementations and APIs should be simple and flexible.
183+
184+
At the end of the day, what we want is for this library to be pretty
185+
light-weight, simple, and understandable.
186+
187+
## Contributors
188+
189+
Thanks goes to these people ([emoji key][emojis]):
190+
191+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
192+
<!-- prettier-ignore -->
193+
194+
<!-- ALL-CONTRIBUTORS-LIST:END -->
195+
196+
This project follows the [all-contributors][all-contributors] specification.
197+
Contributions of any kind welcome!
198+
199+
## Docs
200+
201+
[**Read The Docs**](https://testing-library.com/svelte) |
202+
[Edit the docs](https://github.com/alexkrolick/testing-library-docs)
203+
204+
## Issues
205+
206+
_Looking to contribute? Look for the [Good First Issue][good-first-issue]
207+
label._
208+
209+
### 🐛 Bugs
210+
211+
Please file an issue for bugs, missing documentation, or unexpected behavior.
212+
213+
[**See Bugs**][bugs]
214+
215+
### 💡 Feature Requests
216+
217+
Please file an issue to suggest new features. Vote on feature requests by adding
218+
a 👍. This helps maintainers prioritize what to work on.
219+
220+
[**See Feature Requests**][requests]
221+
222+
### ❓ Questions
223+
224+
For questions related to using the library, please visit a support community
225+
instead of filing an issue on GitHub.
226+
227+
- [Spectrum][spectrum]
228+
- [Stack Overflow][stackoverflow]
229+
230+
## LICENSE
231+
232+
MIT
233+
234+
<!--
235+
Links:
236+
-->
237+
238+
<!-- prettier-ignore-start -->
239+
240+
[npm]: https://www.npmjs.com/
241+
[node]: https://nodejs.org
242+
[build-badge]: https://img.shields.io/travis/testing-library/svelte-testing-library.svg?style=flat-square
243+
[build]: https://travis-ci.org/testing-library/svelte-testing-library
244+
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square
245+
[coverage]: https://codecov.io/github/testing-library/svelte-testing-library
246+
[version-badge]: https://img.shields.io/npm/v/svelte-testing-library.svg?style=flat-square
247+
[package]: https://www.npmjs.com/package/svelte-testing-library
248+
[downloads-badge]: https://img.shields.io/npm/dm/svelte-testing-library.svg?style=flat-square
249+
[npmtrends]: http://www.npmtrends.com/svelte-testing-library
250+
[spectrum-badge]: https://withspectrum.github.io/badge/badge.svg
251+
[spectrum]: https://spectrum.chat/testing-library
252+
[license-badge]: https://img.shields.io/npm/l/svelte-testing-library.svg?style=flat-square
253+
[license]: https://github.com/testing-library/svelte-testing-library/blob/master/LICENSE
254+
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
255+
[prs]: http://makeapullrequest.com
256+
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
257+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
258+
[coc]: https://github.com/testing-library/svelte-testing-library/blob/master/CODE_OF_CONDUCT.md
259+
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
260+
[github-watch]: https://github.com/testing-library/svelte-testing-library/watchers
261+
[github-star-badge]: https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
262+
[github-star]: https://github.com/testing-library/svelte-testing-library/stargazers
263+
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20svelte-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fi.8713187.xyz%2Ftesting-library%2Fsvelte-testing-library%20%F0%9F%91%8D
264+
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/svelte-testing-library.svg?style=social
265+
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
266+
[all-contributors]: https://github.com/all-contributors/all-contributors
267+
[set-immediate]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate
268+
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
269+
[bugs]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
270+
[requests]: https://github.com/testing-library/svelte-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
271+
[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"+
272+
[stackoverflow]: https://stackoverflow.com/questions/tagged/svelte-testing-library
273+
[react-hooks-testing-library]: https://github.com/mpeyper/react-hooks-testing-library
274+
275+
<!-- prettier-ignore-end -->
276+
277+

0 commit comments

Comments
 (0)