Expectations

a minimalist's unit testing framework

This project is maintained by jaycfields

expectations

adding signal, removing noise

Colorizing Output

After version 1.4.2, expectations prints colorized results by default on non-windows boxes.

The following screenshot is an example of the output when no tests are failing:


And, the following screenshot is an example of the output when there are failures or errors:


Colorized output is one of those small things that is easy to de-prioritize, but once it's done you can't figure out why you didn't do it earlier. The code to colorize your results is very simple, and there's even a lib, colorize, if you prefer to simply include a dependency instead.

Of course, if you prefer to stick with non-colorized results that's possible as well - simply set the environment variable EXPECTATIONS_COLORIZE to 'false'.

Remove 'raw' Output

By default, expectations pretty-prints the raw expectation. Below is the output from a failing test, in a terminal. (raw expectation in lightblue)
The raw expectation is (probably) helpful when you're running tests from the command line; however, that same output is probably noise when you're running tests inside emacs. When using expectations-mode the failing (or erroring) expectation will be highlighted, and you can hit C-c ' to see the details. The details appear in the minibuffer, and I can't see much value in printing the raw expectation - (a) it forces the minibuffer to a larger size and (b) the raw expectation is directly in front of you, you had to have the cursor on it to see the details.

To (once again) remove noise, you can set the EXPECTATIONS_SHOW_RAW environment var to 'false', and the raw expectation will no longer appear in the details. Below is the same output as what's shown above in the terminal; however, it's shown in emacs and the raw expectation is omitted.