-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenv-tweaks.html
More file actions
98 lines (88 loc) · 5.9 KB
/
env-tweaks.html
File metadata and controls
98 lines (88 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Expectations by jaycfields</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<script src="javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1 class="header">Expectations</h1>
<p class="header">a minimalist's unit testing framework</p>
<ul>
<li><a class="buttons" href="index.html">Home</a></li>
<li><a class="buttons" href="installing.html">Installing</a></li>
<li><a class="buttons" href="introduction.html">Introduction</a></li>
<li><a class="buttons" href="advanced.html">Advanced</a></li>
<li><a class="buttons" href="collections.html">Collections</a></li>
<li><a class="buttons" href="templating.html">Expect More</a></li>
<li><a class="buttons" href="odds-ends.html">Odds & Ends</a></li>
<li><a class="buttons" href="in-context.html">Around Each</a></li>
<li><a class="buttons" href="before-run-hook.html">Around Suite</a></li>
<li><a class="buttons" href="state-warnings.html">State Warnings</a></li>
<li><a class="buttons" href="redef-state.html">Redef State</a></li>
<li><a class="buttons" href="interactions.html">Side Effects</a></li>
<li><a class="buttons" href="freeze-time.html">Freeze Time</a></li>
<li><a class="buttons" href="env-tweaks.html">ENV Tweaks</a></li>
<li><a class="buttons" href="emacs-tweaks.html">emacs Tweaks</a></li>
<li><a class="buttons" href="clojure-test.html">clojure.test</a></li>
<li><a class="buttons github" href="https://github.com/clojure-expectations/expectations">View On GitHub</a></li>
</ul>
<p class="header">This project is maintained by <a class="header name" href="https://github.com/seancorfield">seancorfield</a> and <a class="header name" href="https://github.com/jaycfields">jaycfields</a></p>
</header>
<section>
<h1>
<a name="expectations" class="anchor" href="#expectations"><span class="octicon octicon-link"></span></a>expectations</h1>
<blockquote>
<p>adding signal, removing noise</p>
</blockquote>
<h2>
<a name="envcolor" class="anchor" href="#envcolor"><span class="octicon octicon-link"></span></a>Colorizing Output</h2>
After version 1.4.2, expectations prints colorized results by default on non-windows boxes.
<br><br>
The following screenshot is an example of the output when no tests are failing:
<br><br>
<div class="separator" style="clear: both;">
<a href="http://3.bp.blogspot.com/-zlr9XXR-uLQ/T6_gdCp5R2I/AAAAAAAAAFw/yHY4UzHsl9I/s1600/Screen%2Bshot%2B2012-05-13%2Bat%2B12.24.38%2BPM.png" imageanchor="1" style=""><img border="0" height="122" width="400" src="http://3.bp.blogspot.com/-zlr9XXR-uLQ/T6_gdCp5R2I/AAAAAAAAAFw/yHY4UzHsl9I/s400/Screen%2Bshot%2B2012-05-13%2Bat%2B12.24.38%2BPM.png" /></a></div>
<br>
And, the following screenshot is an example of the output when there are failures or errors:
<br><br>
<div class="separator" style="clear: both;">
<a href="http://1.bp.blogspot.com/-8mJhAQkQU4M/UbdtZ5iJZ_I/AAAAAAAAAPs/R0n-7YBVvp4/s1600/Screenshot+from+2013-06-11+14:32:49.png" imageanchor="1" ><img border="0" width="400" src="http://1.bp.blogspot.com/-8mJhAQkQU4M/UbdtZ5iJZ_I/AAAAAAAAAPs/R0n-7YBVvp4/s320/Screenshot+from+2013-06-11+14:32:49.png" /></a>
</div>
<br>
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, <a href="https://github.com/ibdknox/colorize">colorize</a>, if you prefer to simply include a dependency instead.
<br><br>
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'.
<br><br>
<h2><a name="envcolor" class="anchor" href="#envcolor"><span class="octicon octicon-link"></span></a>Remove 'raw' Output</h2>
By default, expectations pretty-prints the raw expectation. Below is the output from a failing test, in a terminal. (raw expectation in lightblue)
<div class="separator" style="clear: both;">
<a href="images/fail-with-raw.png"><img border="0" width="400" src="images/fail-with-raw.png"/></a>
</div>
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 <a href="https://github.com/clojure-expectations/expectations-mode">expectations-mode</a> the failing (or erroring) expectation will be highlighted, and you can hit <code>C-c '</code> 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.
<br><br>
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.
<div class="separator" style="clear: both;">
<a href="images/fail-without-raw.png"><img border="0" width="400" src="images/fail-without-raw.png"/></a>
</div>
</section>
<footer>
<p><small>Hosted on <a href="https://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p>
</footer>
</div>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
</body>
</html>