-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: Console output test util #1370
feat: Console output test util #1370
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1370 +/- ##
=======================================
Coverage 45.55% 45.55%
=======================================
Files 506 506
Lines 34889 34895 +6
Branches 8709 8710 +1
=======================================
+ Hits 15892 15898 +6
Misses 18946 18946
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more.
|
packages/utils/src/TestUtils.ts
Outdated
/** | ||
* Selectively disable logging methods on `console` object. Uses spyOn so that | ||
* changes will be reverted after leaving the test scope that it is set in. If | ||
* no method names are given, all will be disabled. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe change this to a single param that takes an array and then clarify the intention w/ @param methodNames The console methods to disable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main benefit would be adding params in the future is easier if needed, but I don't expect this to be used too often.
I think part of my tendency also stems from before ...rest
existed and you had to use arguments
as a magic value if you wanted to use variadic functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably just add the jsdoc on this one and leave the rest param unless you feel strongly otherwise
Do you have a specific example for using this right now? Is it just to disable 3rd party logging like react warning about unmounting component lifecycles? Our log package should be silent during tests by default |
There are a few prop type warning / errors in existing tests which might be good candidates. The specific use case though is in |
Console output test util
resolves #1369