<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=ServerJS%2FUnit_Testing%2FA</id>
	<title>ServerJS/Unit Testing/A - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=ServerJS%2FUnit_Testing%2FA"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;action=history"/>
	<updated>2026-04-13T08:26:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156821&amp;oldid=prev</id>
		<title>KrisKowal: run returns status code</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156821&amp;oldid=prev"/>
		<updated>2009-07-22T06:34:28Z</updated>

		<summary type="html">&lt;p&gt;run returns status code&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:34, 22 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot;&gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Test ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Test ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;quot;test&amp;quot; module provides a &amp;quot;run&amp;quot; method that runs unit tests and catalogs their results.  The idiom for a self-running test module program would be:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;quot;test&amp;quot; module provides a &amp;quot;run&amp;quot; method that runs unit tests and catalogs their results&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.  The &amp;quot;run&amp;quot; method must return the total number of failures, suitable for use as a process exit status code&lt;/ins&gt;.  The idiom for a self-running test module program would be:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  if (module.id == require.main)  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  if (module.id == require.main)  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>KrisKowal</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156820&amp;oldid=prev</id>
		<title>KrisKowal: typos and refinements</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156820&amp;oldid=prev"/>
		<updated>2009-07-22T06:31:38Z</updated>

		<summary type="html">&lt;p&gt;typos and refinements&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:31, 22 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The truth assertion tests whether a value is identical to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The truth assertion tests whether a value is identical to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isTrue(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value&lt;/del&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isTrue(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;actual&lt;/ins&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Falsity:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Falsity:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isFalse(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value&lt;/del&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isFalse(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;actual&lt;/ins&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The nullity assertion tests whether a value is identical to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.  &amp;lt;tt&amp;gt;undefined&amp;lt;/tt&amp;gt; is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;equal &lt;/del&gt;but not &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;equivalent &lt;/del&gt;to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, so checking whether a value is null or undefined can be determined by &amp;lt;tt&amp;gt;assert.eq(value)&amp;lt;/tt&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The nullity assertion tests whether a value is identical to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.  &amp;lt;tt&amp;gt;undefined&amp;lt;/tt&amp;gt; is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;equivalent &lt;/ins&gt;but not &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;identical &lt;/ins&gt;to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, so checking whether a value is null or undefined can be determined by &amp;lt;tt&amp;gt;assert.eq(value)&amp;lt;/tt&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isNull(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value&lt;/del&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.isNull(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;actual&lt;/ins&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The truthiness assertion tests whether a value is equivalent to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt; operator.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The truthiness assertion tests whether a value is equivalent to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt; operator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;assert.eqTrue(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value&lt;/del&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;assert.eqTrue(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;actual&lt;/ins&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Falsiness:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Falsiness:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.eqFalse(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value&lt;/del&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  assert.eqFalse(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;actual&lt;/ins&gt;, [message]);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Not a number:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Not a number:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>KrisKowal</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156788&amp;oldid=prev</id>
		<title>KrisKowal: Wrote up a unit testing proposal in normative terms.</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Unit_Testing/A&amp;diff=156788&amp;oldid=prev"/>
		<updated>2009-07-22T03:49:28Z</updated>

		<summary type="html">&lt;p&gt;Wrote up a unit testing proposal in normative terms.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Assert ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;assert&amp;lt;/tt&amp;gt; module provides functions that throw &amp;lt;tt&amp;gt;AssertionError&amp;lt;/tt&amp;gt;&amp;#039;s when particular conditions are not met.  The &amp;lt;tt&amp;gt;assert&amp;lt;/tt&amp;gt; module must conform to the following interface.&lt;br /&gt;
&lt;br /&gt;
 var assert = require(&amp;quot;assert&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The AssertionError is defined in &amp;lt;tt&amp;gt;assert&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 new assert.AssertionError(message, actual, expected)&lt;br /&gt;
 assert.AssertionError instanceof Error&lt;br /&gt;
&lt;br /&gt;
All of the following functions may throw an &amp;lt;tt&amp;gt;AssertionError&amp;lt;/tt&amp;gt; when a corresponding condition is not met, with a message that may be undefined if not provided.  All assertion methods provide both the actual and expected values to the assertion error for display purposes.&lt;br /&gt;
&lt;br /&gt;
The equivalence assertion tests a deep equality relation.  All identical values are equivalent, as determined by &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt;.  For pairs of values that both pass &amp;lt;tt&amp;gt;Array.isArray&amp;lt;/tt&amp;gt;, equivalence is determined by identical length and the equivalence of all respective content.  Other pairs that do not both pass &amp;lt;tt&amp;gt;typeof value == &amp;quot;object&amp;quot;&amp;lt;/tt&amp;gt;, equivalence is determined by &amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt;.  For all other &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt; pairs, equivalence is determined by having the same number of owned properties (as verified with &amp;lt;tt&amp;gt;Object.prototype.hasOwnProperty.call&amp;lt;/tt&amp;gt;), the same set of keys (although not necessarily the same order), equivalent values for every corresponding key, and an identical &amp;quot;prototype&amp;quot; property.&lt;br /&gt;
&lt;br /&gt;
 assert.eq(expected, actual, [message]); &lt;br /&gt;
&lt;br /&gt;
Non-equivalence:&lt;br /&gt;
&lt;br /&gt;
 assert.ne(expected, actual, [message]); &lt;br /&gt;
&lt;br /&gt;
The identity assertion tests shallow identity with &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 assert.is(expected, actual, [message]);&lt;br /&gt;
&lt;br /&gt;
Non-identity:&lt;br /&gt;
&lt;br /&gt;
 assert.isnt(expected, actual, [message]);&lt;br /&gt;
&lt;br /&gt;
The truth assertion tests whether a value is identical to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
 assert.isTrue(value, [message]);&lt;br /&gt;
&lt;br /&gt;
Falsity:&lt;br /&gt;
&lt;br /&gt;
 assert.isFalse(value, [message]);&lt;br /&gt;
&lt;br /&gt;
The nullity assertion tests whether a value is identical to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;===&amp;lt;/tt&amp;gt; operator.  &amp;lt;tt&amp;gt;undefined&amp;lt;/tt&amp;gt; is equal but not equivalent to &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;, so checking whether a value is null or undefined can be determined by &amp;lt;tt&amp;gt;assert.eq(value)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 assert.isNull(value, [message]);&lt;br /&gt;
&lt;br /&gt;
The truthiness assertion tests whether a value is equivalent to &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, as determined by the &amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
assert.eqTrue(value, [message]);&lt;br /&gt;
&lt;br /&gt;
Falsiness:&lt;br /&gt;
&lt;br /&gt;
 assert.eqFalse(value, [message]);&lt;br /&gt;
&lt;br /&gt;
Not a number:&lt;br /&gt;
&lt;br /&gt;
 assert.isNaN(value, [message]);&lt;br /&gt;
&lt;br /&gt;
Expected to throw an error:&lt;br /&gt;
&lt;br /&gt;
 assert.error(block, [message]);&lt;br /&gt;
&lt;br /&gt;
Expected to throw a particular type of error, distinguished by arguments length.&lt;br /&gt;
&lt;br /&gt;
 assert.error(block, ErrorType, [message]);&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;test&amp;quot; module provides a &amp;quot;run&amp;quot; method that runs unit tests and catalogs their results.  The idiom for a self-running test module program would be:&lt;br /&gt;
&lt;br /&gt;
 if (module.id == require.main) &lt;br /&gt;
   require(&amp;quot;test&amp;quot;).run(exports); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;run&amp;lt;/tt&amp;gt; must accept any &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt;, usually a unit test module&amp;#039;s exports.  &amp;quot;run&amp;quot; will scan the object for all methods and object properties that have names that begin with &amp;quot;test&amp;quot;, and certain flags.  Sub-objects will be run as sub-tests.&lt;br /&gt;
&lt;br /&gt;
 exports.testPatience(function () {&lt;br /&gt;
   require(&amp;#039;os&amp;#039;).sleep(1000);&lt;br /&gt;
 });&lt;br /&gt;
&lt;br /&gt;
 exports.subTest = require(&amp;quot;./subTest&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
Test names may be any String that begins with &amp;quot;test&amp;quot;, not necessarily respecting a case convention.&lt;br /&gt;
&lt;br /&gt;
 [&lt;br /&gt;
   [{&amp;quot;a: 10}, {&amp;quot;a&amp;quot;: 10}],&lt;br /&gt;
   [[1, 2, 3], [1, 2, 3]]&lt;br /&gt;
 ].forEach(function (pair) {&lt;br /&gt;
    exports[&amp;#039;test &amp;#039; + util.repr(pair[0])] = function () {&lt;br /&gt;
      assert.eq.apply(assert, pair);&lt;br /&gt;
    };&lt;br /&gt;
 });&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;addsGlobals&amp;lt;/tt&amp;gt; flag must suppress the test runner from failing any test that adds a property to the global object.  Otherwise, the test runner may make this check to spot likely missing &amp;lt;tt&amp;gt;var&amp;lt;/tt&amp;gt; declarations.&lt;br /&gt;
&lt;br /&gt;
 exports.addsGlobals = true;&lt;/div&gt;</summary>
		<author><name>KrisKowal</name></author>
	</entry>
</feed>