61 Commits

Author SHA1 Message Date
Michał Pierzchała dafad90bb6 chore: release 1.3.1 v1.3.1 2018-11-13 19:47:18 +01:00
Michał Pierzchała 130ab3dd12 chore: update conventional-changelog-cli to version 2.0.11 (#58)
* chore(package): update conventional-changelog-cli to version 2.0.11

* chore(package): update lockfile yarn.lock
2018-11-13 19:42:14 +01:00
greenkeeper[bot] f0dc737dee chore: update flow-bin to the 0.86.0 🚀 (#51)
* chore(package): update flow-bin to version 0.85.0

* chore(package): update lockfile yarn.lock

* update lockfile

* update untyped rn entries
2018-11-13 19:34:57 +01:00
Michał Pierzchała d6d225d825 fix: getAllBy* methods return more elements than expected (#57)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

While upgrading the RN dev dep to 0.57.5 our test suite caught a bug, where `getAllBy*` methods would return more elements than expected. This is fixed by making sure we check the proper type of the parameter when we compare it directly to `node.type` (should be a function, but we allowed strings)

### Test plan

Updated snapshot (yay! RN fixed the display names of View and Text)
2018-11-13 19:26:47 +01:00
greenkeeper[bot] b82e56c3c5 chore: Update react to 16.6.1 🚀 (#54)
* chore(package): update react to version 16.6.1

* chore(package): update react-test-renderer to version 16.6.1

* chore(package): update lockfile yarn.lock
2018-11-09 09:24:41 +01:00
greenkeeper[bot] eb0c220a7f chore: Update metro-react-native-babel-preset to 0.49.0 🚀 (#52)
## The devDependency [metro-react-native-babel-preset](https://github.com/facebook/metro) was updated from `0.48.3` to `0.49.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

[Find out more about this release](https://github.com/facebook/metro).

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2018-10-30 18:00:58 +01:00
Shawn Axsom d3146aaf11 docs: Documentation update for The Problem section of the README, clarifying Enzyme capabilities while highlighting more react-native-testing-library benefits (#43) 2018-10-25 11:45:53 +02:00
greenkeeper[bot] 2c68384abc chore: Update react to 16.6.0 🚀 (#45)
* chore(package): update react to version 16.6.0

* chore(package): update react-test-renderer to version 16.6.0

* chore(package): update lockfile yarn.lock

* fix lockfile
2018-10-25 11:45:20 +02:00
greenkeeper[bot] bacbb3ebaa chore: Update flow-bin to the latest version 🚀 (#47)
* chore(package): update flow-bin to version 0.84.0

* chore(package): update lockfile yarn.lock

* fix flow
2018-10-25 11:38:03 +02:00
Ben Styles 174a5d0f76 docs: Remove reference to instance in readme (#42) 2018-10-20 19:48:27 +02:00
Michał Pierzchała 1ed1337362 chore: release 1.3.0 v1.3.0 2018-10-18 10:20:07 +02:00
Michał Pierzchała 6fbbe2cdf5 feat: make debug.deep more usable (#40)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Make `debug.deep` more usable by allowing it to print arbitrary JSON (and actually any) files. This proves handy when we want to debug async component which we want to snapshot after async operations:

```jsx
const { toJSON, getByName } = render(
  <Button onPress={jest.fn} text="Press me" />
);
fireEvent.press(getByName('TouchableOpacity'));
await flushMicrotasksQueue();

debug.deep(toJSON());
```

### Test plan

added one
2018-10-18 09:13:47 +02:00
Michał Pierzchała 44ca90ced8 chore: release 1.2.0 v1.2.0 2018-10-17 22:14:42 +02:00
Michał Pierzchała 45f45bf1b4 feat: move pretty-format from peer do deps (#39)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

We could also make it an optional dependency and inline-require it inside debug (the only place we use it) but for now I decided to make it a regular dependency, because that's what it is, no point in making users install it directly.

### Test plan

green CI
2018-10-17 22:12:18 +02:00
Michał Pierzchała 22ffe8405b chore: add release-it for release and changelog automation (#38) 2018-10-17 16:18:03 +02:00
Michał Pierzchała f0057bc2f8 v1.1.0 v1.1.0 2018-10-16 22:03:42 +02:00
Michał Pierzchała 05db7bcaac feat: add debug.deep and debug.shallow (#37)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Adds API proposed by https://github.com/callstack/react-native-testing-library/pull/33#issuecomment-430302079.
Also component output is now highlighted:

<img width="259" alt="screenshot 2018-10-16 at 19 33 25" src="https://user-images.githubusercontent.com/5106466/47035614-c10efb80-d17a-11e8-99ac-00f648880008.png">


### Test plan

Added tests for `debug`.
2018-10-16 21:45:56 +02:00
Michał Pierzchała 03e2c4b0f2 fix: use actual react-native instead of homegrown mocks (#36)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

This actually uncovered some bugs, like lack of `onDoublePress` (lol XD) and enabled us to have better snapshots for deep rendering.

### Test plan

no new tests
2018-10-16 18:51:01 +02:00
Michał Pierzchała 07d3be1c51 feat: add toJSON to render; cleanup shallow (#35)
* feat: add toJSON to render; cleanup shallow

* Remove empty dependencies entry

* revert shallow import

* add docs

* add TS typings
2018-10-16 18:00:54 +02:00
greenkeeper[bot] 61f6895b32 chore: Update @callstack/eslint-config to the latest version 🚀 (#34)
## The devDependency [@callstack/eslint-config](https://github.com/callstack/eslint-config-callstack) was updated from `2.0.0` to `3.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v3.0.0</summary>

<ul>
<li>breaking: update <code>eslint-config-prettier</code> to v3.0.1</li>
<li>breaking: update <code>babel-eslint</code> to v10.0.1</li>
<li>breaking: update <code>eslint-plugin-flowtype</code> to v3.0.0</li>
<li>breaking: require ESLint 5 as peer dependency (because of above mentioned deps bump)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 6 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/79c5f38a5a26b773fb2d8999bad44f7e06070831"><code>79c5f38</code></a> <code>v3.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/3201e419a2fb25a1cc68df724c239a78246591f4"><code>3201e41</code></a> <code>breaking: require ESLint 5 as peer dependency</code></li>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/ca82ca09ad4de6d8039e909a11559b92a84b0be9"><code>ca82ca0</code></a> <code>chore: update yarn.lock with latest deps</code></li>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/4528e06ecbd759c328a9825ccc8b6a141ed8ab74"><code>4528e06</code></a> <code>Greenkeeper/initial (#37)</code></li>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/4a73ea786f8bac2d28e0e004f4029d3a594a710f"><code>4a73ea7</code></a> <code>Mention issues with CRA (#33)</code></li>
<li><a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/commit/845b88002ed93415a9d229a07b02d4dced6ef265"><code>845b880</code></a> <code>v2.0.0</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/callstack/eslint-config-callstack/compare/0c260dafa7c2522ea46ac3f4cb5fc9cfb21b7f9e...79c5f38a5a26b773fb2d8999bad44f7e06070831">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2018-10-16 13:57:34 +02:00
Kacper Wiszczuk a066544019 fix: Remove unnecessary flow expression (#31) 2018-10-15 20:57:13 +02:00
Kacper Wiszczuk a39f879288 fix: do not bubble event to root element (#30)
Remove bubbling events to the root element as in the most common use case we pass handler prop to the root element:
```jsx
// That's usually what we do in tests
const tree = render(<SomeElement onPress={mockedHandler} />);

// Unsupported use case
const tree = render(<TouchableOpacity onPress={mockHandler()}><Text>XD</Text></TouchableOpacity>)
```
2018-10-15 17:03:30 +02:00
greenkeeper[bot] 8f89cd51ee Update flow-bin to the latest version 🚀 (#25)
* chore(package): update flow-bin to version 0.83.0

* fix do not use frozen lockfile

* fix update yarn.lock
2018-10-11 22:44:30 +02:00
Michał Pierzchała 70938661ec v1.0.0 v1.0.0 2018-10-11 14:56:03 +02:00
Simen Bekkhus 6097c8f64c chore: fix typos in readme (#22) 2018-10-11 00:10:06 +02:00
Michał Pierzchała 9afa73a0f5 v0.2.3 v0.2.3 2018-10-10 21:47:18 +02:00
Kacper Wiszczuk 480dd28cbc feat: Add Typescript types to waitForElement (#21)
Fix types for Flow too
2018-10-10 21:45:32 +02:00
Michał Pierzchała d5219d2e93 feat: add waitForElement (#20)
* feat: add waitForElement

* add docs

* update docs
2018-10-10 21:06:06 +02:00
Michał Pierzchała 254127781c test: add tests for shallow rendering (#19) 2018-10-10 17:38:20 +02:00
Kacper Wiszczuk b6569a6e5d feat Add Typescript types (#18) 2018-10-07 22:32:12 +02:00
Michał Pierzchała 0ce1d7ec47 update greenkeeper badge 2018-10-07 19:02:48 +02:00
Michał Pierzchała 14535cad14 v0.2.2 v0.2.2 2018-10-07 17:13:34 +02:00
Michał Pierzchała 2f002014cf fix: stack traces for get APIs (#17)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

When moving `get` APIs outside of `render`, we needed to wrap them with a closure injecting `instance` to act on. This resulted in an anonymous callsite that wasn't properly processed by our `ErrorWithStack` helper.



### Test plan

|before|after|
|--|--|
|<img width="305" alt="screenshot 2018-10-07 at 16 09 27" src="https://user-images.githubusercontent.com/5106466/46582694-6fb08f00-ca4b-11e8-94f8-40dcb2211d46.png">|<img width="491" alt="screenshot 2018-10-07 at 16 09 18" src="https://user-images.githubusercontent.com/5106466/46582698-73dcac80-ca4b-11e8-94ce-4fd16ce1f845.png">|
2018-10-07 17:10:26 +02:00
Michał Pierzchała 90fb410f48 v0.2.1 v0.2.1 2018-10-07 14:51:14 +02:00
Kacper Wiszczuk 4f0501e6b5 fix: Flow types (#16)
- [x] - Add flow to tests
- [x] - Fix flow typings
- [x] - Update documentation
2018-10-07 14:50:05 +02:00
greenkeeper[bot] d2e00f5264 Update dependencies to enable Greenkeeper 🌴 (#14)
Let’s get started with automated dependency management for react-native-testing-library 💪

🔒 Greenkeeper has found a `yarn.lock` file in this repository. Greenkeeper supports lockfile updates for public packages. If you use private packages in your repository, please use [greenkeeper-lockfile](https://github.com/greenkeeperio/greenkeeper-lockfile) to make sure these can get updated as well.

This pull request **updates all your dependencies to their latest version**. Having them all up to date really is the best starting point for keeping up with new releases. Greenkeeper will look out for further dependency updates and make sure to handle them in isolation and in real-time, but only after **you merge this pull request**.

**Important: Greenkeeper will only start watching this repository’s dependency updates after you merge this initial pull request**.





---
<details>
<summary>🏷 How to check the status of this repository</summary>

Greenkeeper adds a badge to your README which indicates the status of this repository.

This is what your badge looks like right now 👉  ![Greenkeeper badge](https://badges.greenkeeper.io/callstack/react-native-testing-library.svg)
</details>
<details>
<summary>🙈 How to ignore certain dependencies</summary>

You may have good reasons for not wanting to update to a certain dependency right now. In this case, you can [change the dependency’s version string in the `package.json` file back to whatever you prefer](https://github.com/callstack/react-native-testing-library/edit/greenkeeper/initial/package.json).

To make sure Greenkeeper doesn’t nag you again on the next update, add a `greenkeeper.ignore` field to your `package.json`, containing a list of dependencies you don’t want to update.

```js
// package.json
{
  …
  "greenkeeper": {
    "ignore": [
      "package-names",
      "you-want-me-to-ignore"
    ]
  }
}
```
</details>
<details>
<summary>👩‍💻 How to update this pull request</summary>

```bash
  # Change into your repository’s directory
  git fetch --all
  git checkout greenkeeper/initial
  npm install-test
  # Adapt your code until everything works again
  git commit -m 'chore: adapt code to updated dependencies'
  git push https://github.com/callstack/react-native-testing-library.git greenkeeper/initial
```
</details>
<details>
<summary> How do dependency updates work with Greenkeeper?</summary>

After you merge this pull request, **Greenkeeper will create a new branch whenever a  dependency is updated**, with the new version applied. The branch creation should trigger your testing services and check whether your code still works with the new dependency version. Depending on the the results of these tests Greenkeeper will try to open meaningful and helpful pull requests and issues, so your dependencies remain working and up-to-date.

```diff
-  "underscore": "^1.6.0"
+  "underscore": "^1.7.0"
```

The above example shows an in-range update. `1.7.0` is included in the old `^1.6.0` range, because of the [caret `^` character ](https://docs.npmjs.com/misc/semver#ranges).
When the test services report success Greenkeeper will silently delete the branch again, because no action needs to be taken – everything is fine.

However, should the tests fail, Greenkeeper will create an issue to inform you about the problem immediately.

This way, you’ll never be surprised by a dependency breaking your code. As long as everything still works, Greenkeeper will stay out of your way, and as soon as something goes wrong, you’ll be the first to know.

```diff
-  "lodash": "^3.0.0"
+  "lodash": "^4.0.0"
```

In this example, the new version `4.0.0` is _not_ included in the old `^3.0.0` range.
For version updates like these – let’s call them “out of range” updates – you’ll receive a pull request.

This means that **you no longer need to check for new versions manually** – Greenkeeper will keep you up to date automatically.

These pull requests not only serve as reminders to update: If you have solid tests and good coverage, and the pull requests passes those tests, you can very likely just merge it and release a new version of your software straight away :shipit:

To get a better idea of which ranges apply to which releases, check out the extremely useful [semver calculator](https://semver.npmjs.com/) provided by npm.
</details>
<details>
<summary>FAQ and help</summary>

There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>


---

Good luck with your project and see you soon 

Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2018-10-07 11:40:29 +02:00
Michał Pierzchała c6c4036d04 update npmignore v0.2.0 2018-10-07 11:03:14 +02:00
Michał Pierzchała 5b7e8e8e30 v0.2.0 2018-10-07 11:01:44 +02:00
Michał Pierzchała 495811bd08 feat: add query API (#13)
* feat: add query API

* use plural for API

* return empty array from queryAll

* fix wording in readme

* move mass exports to get/query files
2018-10-07 10:59:27 +02:00
Kacper Wiszczuk d66255d482 feat: fireEvent API (#11)
Implementation of fireEvent API.

Fixes #7
2018-10-07 08:23:21 +02:00
Michał Pierzchała 9d14406832 BREAKING: make getAllBy* methods throwable (#12)
* BREAKING: make getAllBy* methods throwable

* fix wrong fn args
2018-10-06 23:42:52 +02:00
Michał Pierzchała 08c5725984 docs: move tagline up 2018-10-06 19:40:29 +02:00
Michał Pierzchała 062a43d9e8 docs: add badges 2018-10-06 19:39:44 +02:00
Michał Pierzchała 98825d9d94 chore: add PR template 2018-10-06 19:30:24 +02:00
Michał Pierzchała e22cedb72f chore: setup circleci 2018-10-06 19:25:51 +02:00
Ahmet Cetin 83f6e0dff0 docs: Create CODE_OF_CONDUCT.md (#10)
Relates to #2
2018-10-05 17:20:31 +02:00
Ahmet Cetin 065e11076c docs: Create CONTRIBUTING.md (#9)
issue #2
2018-10-05 17:18:50 +02:00
Michał Pierzchała f7f2103062 feat: improve stack traces for throwable methods 2018-10-05 00:07:55 +02:00
Michał Pierzchała 129bda8aee fix typo 2018-10-04 23:44:59 +02:00
Michał Pierzchała e74e928b4f Add basic tests for render (#8) 2018-10-04 23:41:46 +02:00