3 ms·
> Here’s a rule of thumb I follow. If I comment out a line of code in your module (assuming it still compiles and runs), and ALL your tests still pass, somethin
by shermantanktop 2y ago
> Here’s a rule of thumb I follow. If I comment out a line of code in your module (assuming it still compiles and runs), and ALL your tests still pass, something’s wrong.
So they rigorously test all those logging calls?
- plorkyeran 2y agoIt's certainly low on the list of priorities to test, but yeah, testing all your logging calls is useful. It's how you avoid having something break in production in a non-reproducible way, checking your logs, and discovering that you've been logging your language's equivalent of [object Object] ever since someone refactored that code last year.
- shermantanktop 2y agoI once refactored a server-side codebase due to poor performance, and a significant time suck was - I kid you not - this line (in pseudocode): logger.info(“Request:” + JSON.stringify(httpRequest)); Terrible! I removed it, deployed it, and…alarms went off. It turned out that the line in question was being used to populate a critical metrics feed. In that terrible, terrible case, I agree that the load-bearing log line should be tested. In any other scenario I’d personally avoid it, outside of mission critical medical or other codebases. But that’s me, I understand the impulse to test it.