You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Simple and complete Solid DOM testing utilities that encourage good testing
5
6
practices.</p>
6
7
@@ -13,14 +14,18 @@ practices.</p>
13
14
14
15
</div>
15
16
16
-
<hr />
17
+
---
17
18
18
19
## Table of Contents
19
20
20
21
-[The Problem](#the-problem)
21
22
-[The Solution](#the-solution)
22
23
-[Installation](#installation)
23
24
-[Docs](#docs)
25
+
-[Issues](#issues)
26
+
-[Acknowledgement](#acknowledgment)
27
+
28
+
---
24
29
25
30
## The Problem
26
31
@@ -38,16 +43,39 @@ The Solid Testing Library is a very lightweight solution for testing Solid compo
38
43
This module is distributed via npm which is bundled with node and should be installed
39
44
as one of your project's `devDependencies`:
40
45
41
-
```
46
+
```sh
42
47
npm install --save-dev solid-testing-library
43
48
```
49
+
44
50
If you using Jest we recommend using [solid-jest](https://github.com/solidjs/solid-jest) to properly resolve the browser version of Solid as Jest will default to the server version when run in Node.
45
51
46
-
💡 You may also be interested in installing `@testing-library/jest-dom` so you can use
52
+
💡 If you are using Jest or vitest, you may also be interested in installing `@testing-library/jest-dom` so you can use
47
53
[the custom jest matchers](https://github.com/testing-library/jest-dom).
48
54
49
55
## Docs
50
56
51
-
TODO
52
-
<!-- See the [docs](https://testing-library.com/docs/preact-testing-library/intro) over at the Testing
53
-
Library website. -->
57
+
See the [docs](https://testing-library.com/docs/preact-testing-library/intro) over at the Testing Library website.
58
+
59
+
There are two key difference, though:
60
+
61
+
⚠️ Solid.js does *not* rerender, it merely executes side effects triggered by reactive state that change the DOM, therefore there is no rerender method. You can use global signals to manipulate your test component in a way that causes it to update.
62
+
63
+
Solid.js' reactive changes are pretty instantaneous, so there is rarely need to use `waitFor(…)` or `await findByRole(…)` - with the exception of transitions and Suspense.
64
+
65
+
⚠️ Solid.js external reactive state does not require any DOM elements to run in, so our `renderHook` call has no `container`, `baseElement` or queries in its options or return value. Instead, it has an `owner` to be used with [`runWithOwner`](https://www.solidjs.com/docs/latest/api#runwithowner) if required. It also exposes a `cleanup` function, though this is already automatically called after the test is finished.
66
+
67
+
## Issues
68
+
69
+
If you find any issues, please [check on the issues page](https://github.com/solidjs/solid-testing-library/issues) if they are already known. If not, opening an issue will be much appreciated, even more so if it contains a
70
+
71
+
- short description
72
+
- minimal reproduction code
73
+
- list of possible workarounds, if there are any
74
+
75
+
If you think you can fix an issue yourself, feel free to [open a pull-request](https://github.com/solidjs/solid-testing-library/pulls). If functionality changes, please don't forget to add or adapt tests.
76
+
77
+
## Acknowledgment
78
+
79
+
Thanks goes to [Kent C. Dodds](https://kentcdodds.com/) and his colleagues for creating testing-library and to the creators of [preact-testing-library](https://github.com/testing-library/preact-testing-library).
80
+
81
+
This library has been created by Ryan Carniato and is currently maintained by Alex Lohr.
0 commit comments