Skip to content

fix: check for undefined/null children #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2019
Merged

Conversation

Esemesek
Copy link
Collaborator

Summary

Check for undefined/null values, in getByText nodes.

Fixes #135

Test plan

Passing tests on repro repository https://github.com/wKovacs64/rntl-161-repro.

Have no idea how to create a unit test, to test this behavior.

cc @thymikee @wKovacs64

@thymikee thymikee changed the title Check for undefined/null children fix: check for undefined/null children Mar 19, 2019
@wKovacs64
Copy link

This works in my much larger "real" app, too! 🎉


Out of curiosity, how were you testing this branch in the repro repo? yarn link didn't work for me for some reason, I had to manually copy the build output.

yarn link results

First test:

Currently the only supported library to search by text is "react-native".

Cannot find module 'warnOnce' from 'react-native-implementation.js'

Second test:

No instances found

@thymikee
Copy link
Member

Did you run yarn so that the files are updated in the build/ dir?

@wKovacs64
Copy link

I did indeed.

@Esemesek Esemesek merged commit ccad804 into master Mar 19, 2019
@Esemesek Esemesek deleted the Esemesek/node-by-text-fix branch March 19, 2019 18:47
@Esemesek
Copy link
Collaborator Author

@wKovacs64

  • Install deps
  • Go to node_modules/react-native-testing-library
  • Change "main" in package.json to point to src/index.js instead of build/index.js
  • Edit files in node_modules/react-native-testing-library/src and hack around :P

@wKovacs64
Copy link

@Esemesek Thanks. 🙂

@steobrien
Copy link

Thanks a lot for this fix! Looking forward to seeing it in a release.

@jakemmarsh
Copy link

Any updates on getting this published?

@ryanjwessel
Copy link
Contributor

Not sure if this has been integrated with a release yet, but I am running into this error on version 7.0.1 today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.6.1] Cannot read property 'toString' of null
6 participants