-
-
Notifications
You must be signed in to change notification settings - Fork 44
feat: formatting options for render() to remove options from debug() #70
Conversation
Nice, thanks for starting work on this! I really like the idea and think it will be useful. I'll have a couple of requests to discuss before we merge. Also note that we'll want to document it and make sure the build is passing (right now it's failing on coverage). I don't have enough time to fully respond at the moment but I'll try to circle back to this tonight. Thanks again for getting this going! Looking forward to merging this feature 👍 |
Okay awesome — totally forgot to test coverage 😬I can fix that up. Also wasn’t sure how to update the docs, are there docs on updating the docs? lol cheers |
Codecov Report
@@ Coverage Diff @@
## master #70 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 20 20
Lines 266 268 +2
Branches 67 67
=====================================
+ Hits 266 268 +2
Continue to review full report at Codecov.
|
This is a really neat feature! I too would like to omit particular props from the output. For me it's the Would it make better sense to have this take a function for formatting (a little like One little note on the tests. You want to avoid "global" variables (such as |
cool -- sounds good. can you provide a little snippet for what you mean for the function? I think I initially wanted to provide something similar, but I'm not sure we're on the same page i'll reset log |
Alright sorry for the delay here. I did some testing a while ago, and it turns out the The reason for this change is staying as close as possible to the top-level API of the rest of the Testing Library family. So I think what I personally would like to see the final API for be would be:
I like the name suggestion @lewie9021 made, and if you two want to further discuss the option of allowing a function as the prop, I'm cool with that as well. I'd also like to get @TAGraves opinion and /cc @alexkrolick since this is a minor deviation from the top-level API of testing library on both Once we have a final draft of the PR, I'll do a more thorough code review before merging. Thanks again! 👍 |
One last thought that came to me as soon as I posted the comment is that there's already some stuff in place that does something like this. Currently we filter out any props in debug output where the value of the prop is a function. It just occurred to me that this should either take the place of that or build on-top of it. That happens here. Ultimately the result of |
amazing, thanks for finding that. it will be a lot simpler to implement there than to tack it on to prettyPrint. i totally agree about keeping the api as similar as possible. |
updated the PR -- one last thought I had was that |
Alright I'm good to move forward with this. If there's anything else that comes up, we can iterate and merge later 👍 |
🎉 This PR is included in version 4.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Added a
formatting
option torender()
to optionally remove noisy props from debug outputWhy:
A lot of times I'm not concerned with style props and they can make the debug output hard to read.
How:
Added a config parameter to the
render()
call that will configure prettyFormatChecklist:
docs site
I saw an earlier issue regarding something similar, and I've written an override in my custom render for projects I work on, but I thought others might want this feature as well.