feat: Support for @testing-library/jest-native (#310)

* Added @testing-library/jest-native to devDependencies

* Tests for jest-native matchers

* Added @testing-library/jest-native install info

* Update README.md

* Update GettingStarted.md

* feat: add `findBy*` queries (#304)

* Basic async findBy queries

* Refactored findBy queries to be built with makeFindQuery

* findBy queries for A11y selectors

* Custom findByTestId implementation that avoids current getByTestId issues

* Fixed prettier issue

* Updates Queries.md with findBy queries

* Trying to fix test timeout error appearing only on CI

* Code review changes

* Added typescript types & tests

* prettier did reformat some code arround

* Removed export of GetByAPI, QueryByAPI and FindByAPI interfaces in TS

* Reversed prettier run on typings

* Added overlapping pieces with `within` operator

* Small cleanup

* Update website/docs/Queries.md

* Moved async/await tests to the end of test methods

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>

* chore: bump eslint config to latest (#308)

* chore: bump eslint config to latest

* lint fix

* lint pass

* use roles directly

* Trying to fix CI build

* Added $FlowFixMe for missing flow expect extensions

* Small doc fixes

* Clarified failing toHaveProps matcher tests

* Moved lint ignore for color literals to .eslintrc

* Updated toHaveProp tests to avoid strange `Button` behavior

* Updated yarn.lock

* Update README.md

* Update website/docs/GettingStarted.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
This commit is contained in:
Maciej Jastrzebski
2020-05-18 09:37:59 +02:00
committed by GitHub
parent c482f6ad07
commit 414f8701a5
6 changed files with 202 additions and 2 deletions
+34
View File
@@ -64,12 +64,46 @@ You can find the source of `QuestionsBoard` component and this example [here](ht
Open a Terminal in your project's folder and run:
#### Using `yarn`
```sh
yarn add --dev react-native-testing-library
```
#### Using `npm`
```sh
npm install --save-dev react-native-testing-library
```
This library has a peerDependencies listing for `react-test-renderer` and, of course, `react`. Make sure to install them too!
### Additional Jest matchers
In order to use addtional React Native-specific jest matchers from [@testing-library/jest-native](https://github.com/testing-library/jest-native) package add it to your project:
#### Using `yarn`
```sh
yarn add --dev @testing-library/jest-native
```
#### Using `npm`
```sh
npm install --save-dev @testing-library/jest-native
```
Then automatically add it to your jest tests by using `setupFilesAfterEnv` option in the `jest.config.js` file:
```js
module.exports = {
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
};
```
### Flow
Note for [Flow](https://flow.org) users – you'll also need to install typings for `react-test-renderer`:
```sh