|
1 | 1 | ---
|
2 | 2 | id: intro
|
3 |
| -title: Introduction |
| 3 | +title: Reason Testing Library |
| 4 | +sidebar_label: Introduction |
4 | 5 | ---
|
5 | 6 |
|
6 |
| -[`bs-react-testing-library`][gh] contains |
| 7 | +Bindings for several testing libraries have been ported to [ReasonML][re]. |
| 8 | + |
| 9 | +[`bs-react-testing-library`][gh-react] contains |
7 | 10 | [BuckleScript](https://bucklescript.github.io/) bindings for
|
8 | 11 | `react-testing-library`.
|
9 | 12 |
|
| 13 | +[`bs-dom-testing-library`][gh-dom] contains [BuckleScript][bs] bindings for |
| 14 | +`dom-testing-library`. |
| 15 | + |
10 | 16 | ```
|
| 17 | +npm install --save-dev bs-dom-testing-library |
11 | 18 | npm install --save-dev bs-react-testing-library
|
12 | 19 | ```
|
13 | 20 |
|
14 |
| -- [bs-react-testing-library on GitHub][gh] |
| 21 | +- [bs-react-testing-library on GitHub][gh-react] |
| 22 | +- [bs-dom-testing-library on GitHub][gh-dom] |
15 | 23 |
|
16 |
| -[gh]: https://github.com/wyze/bs-react-testing-library |
| 24 | +[gh-dom]: https://github.com/wyze/bs-dom-testing-library |
| 25 | +[gh-react]: https://github.com/wyze/bs-react-testing-library |
17 | 26 |
|
18 | 27 | ## Setup
|
19 | 28 |
|
20 |
| -After installation, you will need to add it to your `bsconfig.json` file like |
21 |
| -so: |
| 29 | +After installation, you will need the packages `bsconfig.json` file like so: |
22 | 30 |
|
23 | 31 | ```json
|
24 | 32 | {
|
25 | 33 | "bs-dev-dependencies": ["bs-react-testing-library"]
|
26 | 34 | }
|
27 | 35 | ```
|
| 36 | + |
| 37 | +_or_ |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "bs-dev-dependencies": ["bs-dom-testing-library"] |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Other Dependencies |
| 46 | + |
| 47 | +### bs-platform |
| 48 | + |
| 49 | +This is what [BuckleScript][bs] uses to compile the [Reason][re] code to JS. If |
| 50 | +it is not in your project you can install it like so: |
| 51 | + |
| 52 | +``` |
| 53 | +npm install --save-dev bs-platform |
| 54 | +``` |
| 55 | + |
| 56 | +### bs-jest |
| 57 | + |
| 58 | +This is the recommended test runner and is a wrapper around Jest. All of the |
| 59 | +examples here will be using it. |
| 60 | + |
| 61 | +- [bs-jest on GitHub](https://github.com/glennsl/bs-jest) |
| 62 | + |
| 63 | +``` |
| 64 | +npm install --save-dev @glennsl/bs-jest |
| 65 | +``` |
| 66 | + |
| 67 | +Then update `bsconfig.json`: |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "bs-dev-dependencies": ["@glennsl/bs-jest"] |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +[bs]: https://bucklescript.github.io/ |
| 76 | +[re]: https://reasonml.github.io/ |
0 commit comments