|
| 1 | +--- |
| 2 | +id: install |
| 3 | +title: Install |
| 4 | +sidebar_label: Install |
| 5 | +--- |
| 6 | + |
| 7 | +This module is distributed via [npm][npm] and should be installed as one of your |
| 8 | +project's `devDependencies`: |
| 9 | + |
| 10 | +``` |
| 11 | +npm install --save-dev @testing-library/web |
| 12 | +``` |
| 13 | + |
| 14 | +## Wrappers |
| 15 | + |
| 16 | +If you are using a framework or library such as React, you will likely want to |
| 17 | +install the wrapper: |
| 18 | + |
| 19 | +- [React Testing Library](react-testing-library/intro.mdx) |
| 20 | +- [Reason Testing Library](bs-react-testing-library/intro.mdx) |
| 21 | +- [React Native Testing Library](react-native-testing-library/intro.mdx) |
| 22 | +- [Vue Testing Library](vue-testing-library/intro.mdx) |
| 23 | +- [Marko Testing Library](marko-testing-library/intro.mdx) |
| 24 | +- [Angular Testing Library](angular-testing-library/intro.mdx) |
| 25 | +- [Preact Testing Library](preact-testing-library/intro.mdx) |
| 26 | +- [Svelte Testing Library](svelte-testing-library/intro.mdx) |
| 27 | +- [Cypress Testing Library](cypress-testing-library/intro.mdx) |
| 28 | +- [Puppeteer Testing Library](pptr-testing-library/intro.mdx) |
| 29 | +- [Testcafe Testing Library](testcafe-testing-library/intro.mdx) |
| 30 | +- [Nightwatch Testing Library](nightwatch-testing-library/intro.mdx) |
| 31 | + |
| 32 | +## Ecosystem |
| 33 | + |
| 34 | +`Web Testing Library` works well with these companion libraries: |
| 35 | + |
| 36 | +- [user-event](user-event/intro.mdx) browser event simulation |
| 37 | +- [jest-dom](ecosystem-jest-dom.mdx) custom Jest matchers |
| 38 | +- [bs-jest-dom](ecosystem-bs-jest-dom.mdx) companion library for |
| 39 | + `bs-react-testing-library` |
| 40 | +- [jest-native](ecosystem-jest-native.mdx) companion library for |
| 41 | + `React Native Testing Library` |
| 42 | +- [react-select-event](ecosystem-react-select-event.mdx) companion library for |
| 43 | + `React Testing Library` |
| 44 | +- [eslint-plugin-testing-library](ecosystem-eslint-plugin-testing-library.mdx) |
| 45 | + ESLint plugin for Testing Library |
| 46 | +- [eslint-plugin-jest-dom](ecosystem-eslint-plugin-jest-dom.mdx) ESLint plugin |
| 47 | + for Jest DOM |
| 48 | +- [riot-testing-library](ecosystem-riot-testing-library.mdx) adds APIs for |
| 49 | + working with Riot.js components |
| 50 | + |
| 51 | +## Main Exports |
| 52 | + |
| 53 | +You can |
| 54 | +[review the `Web Testing Library` package.json here](https://unpkg.com/@testing-library/web/package.json). |
| 55 | + |
| 56 | +In particular, the `main`, `module`, and `umd:main` fields are useful. Each of |
| 57 | +these points to a file that's useful in certain situations. Typically, your |
| 58 | +testing framework will resolve to the correct one for your situation, but if it |
| 59 | +does not, then you can either configure your testing framework to resolve to the |
| 60 | +right file when you require/import `@testing-library/dom` or you can import the |
| 61 | +file you need more explicitly. For example: |
| 62 | + |
| 63 | +```js |
| 64 | +import {waitFor} from '@testing-library/web/dist/@testing-library/web.umd.js' |
| 65 | +``` |
| 66 | + |
| 67 | +You can |
| 68 | +[review the published `dist` files here](https://unpkg.com/@testing-library/web/dist/). |
| 69 | + |
| 70 | +The `main` file is configured to compile down to support the version of node |
| 71 | +that is referenced in the `package.json` `engines.node` field. But the `module` |
| 72 | +and `umd:main` files are configured to compile down to support browsers as old |
| 73 | +as IE 10. |
| 74 | + |
| 75 | +<!-- |
| 76 | +Links |
| 77 | +--> |
| 78 | + |
| 79 | +[npm]: https://www.npmjs.com/ |
| 80 | +[node]: https://nodejs.org |
0 commit comments