A more concise MiniTest reporter for reducing cognitive load
I love the simplicity of MiniTest, but I wish the test run results were a bit more concise. A cluster of failures already clutter the screen by displaying unnecessary data, requiring you to decipher what actually happened. While not difficult or terrible, it accumulates.
In short, I wrote my own reporter that allows for more concise output of a test run:
- It omits printing detailed results of skipped tests unless the
verbose
option is set to true. This is because for 80% of the time, you’re not dealing with skipped tests. - Test results are sorted by class name, enabling you to quickly glance and detect if your changes affected the test without looking through the list of randomly ordered tests. You can disable sorting by setting
verbose
. - There’s just one line per failed test, which means more room for viewing failed tests before your screen fills up!
- Failed tests show the
rails test <file>
command to re-run the problematic test again. - Failed tests display the source code where the assertion occurred, providing context since the ‘False to be truthy’ error isn’t very descriptive.
- Paths are relative from the project root, allowing you to still ‘command-click’ in your terminal to open the file, while reducing clutter and cognitive load.
Anyway, the code is available on my GitHub, so go ahead and enjoy failing in a more streamlined manner :)