4 ms·
And the incentive to do that is?
by perfunctory 7y ago
And the incentive to do that is?
- holtalanm 7y agoless bugs?
- hluska 7y agoBasically, it’s a good chance to: 1.) Question whether that codepath should be gated to a particular day of the week. 2.) Assess the cost of that codepath failing (or failing to load). Does it have the potential to brick the project? 3.) How big could the bug be? If software tells me it’s “just another manic Monday” on Tuesday, or that I should “Walk like an Egyptian” on February 31, who cares? There is no incentive to unit test because honestly, who cares? On the other hand, if it has the potential to brick the project, go back to #1. Do you really need to test the day of the week? Are you bloody sure?? :) 4.) If you reach #4, it’s time to invest in unit tests. You wrote a condition where a day of the week test could result in software failure.
- jrockway 7y agoI assume the motivation for typing in code is for it to run to completion successfully every time. In this case, because of the bug, Webpack didn't print a message reminding you to donate money to them. You would think you'd want to keep that working, because those donations are what make continued improvement of the software possible. So you write a test for it, and then you can hack on the other parts of the code knowing, with confidence, that your donation reminder works. Even on Windows. Even on Monday.