-
Notifications
You must be signed in to change notification settings - Fork 272
feat: add instance and renderer back to RenderResults #33
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
Conversation
Originally removed in e6ac5ad.
Od rather remove it from the Readme, as that was the intention, just forgot to update it. What's your use case for exposing the renderer? |
Debugging, primarily. react-testing-library's |
We could add this as an API, how about something like: degug(<Component />, {deep: true}) ? or returning I'm also good with adding both. |
|
Yea, we explicitly don't want users to access |
## 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 🌴
Thanks, sorry I wasn't able to get to the revamp - you beat me to it! 🙂 |
No worries, thanks for you contribution, much appreciated! |
Are you still thinking of adding deep debug? I guess that's essentially just a prettified version of toJSON? |
I think we can make it a thing, the API however would rather be On the other hand we could check the type of second parameter so you could either use: debug(<Component />, 'message'); // shorthand, current API
debug(<Component />, {deep: true, message: 'message'}); // debug with more options wdyt? cc @Esemesek |
I don't like those configurations. Methods like debug(<Component />, 'message'); // defaults to shallow
debug.shallow(<Component />, 'message'); // same as above
debug.deep(<Component />, 'message'); // deep debug Additionally, we won't break existing API. |
um, like it! |
Just like |
That looks great. |
we should also use |
@wKovacs64 would you like to build it? |
I don't know jack about Flow, so it'd probably be somewhat of a train wreck. 😉 |
<!-- 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 #33 (comment). 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`.
Closes #32.
Summary
The
instance
andrenderer
fields are documented in the README but were removed fromRenderResult
in e6ac5ad. I think they add value and (at leastrenderer
) should still be included. This PR re-introduces them to the object returned fromrender
.Alternatives:
renderer
(asinstance
is justrenderer.root
anyway)RenderResult
and remove them from the READMETest plan
N/A