Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

docs

TJ Holowaychuk7b3a36f93de0
diff --git a/index.html b/index.html
index 609f459c..78f0c193 100644
--- a/index.html
+++ b/index.html
@@ -273,12 +273,17 @@ Options:
</section>
</code></pre>
-<h3>Browser support</h3>
+<h3>HTML</h3>
-<p>Mocha runs in the browser. Every release of Mocha will have new builds of <em>./mocha.js</em> and <em>./mocha.css</em> for use in the browser. To setup Mocha for browser use all you have to do is include the script, stylesheet, tell Mocha which interface you wish to use, and then run the tests. A typical setup might look something like the following, where we call <code>mocha.setup('bdd')</code> to use the <strong>BDD</strong> interface before loading the test scripts, running them <code>onload</code> with <code>mocha.run()</code>.</p>
+<p>The <strong>HTML</strong> reporter is currently the only browser reporter
+ supported by Mocha, and it looks like this:</p>
<p><img src="images/reporter-html.png" alt="HTML test reporter" title="" /></p>
+<h2>Browser support</h2>
+
+<p>Mocha runs in the browser. Every release of Mocha will have new builds of <em>./mocha.js</em> and <em>./mocha.css</em> for use in the browser. To setup Mocha for browser use all you have to do is include the script, stylesheet, tell Mocha which interface you wish to use, and then run the tests. A typical setup might look something like the following, where we call <code>mocha.setup('bdd')</code> to use the <strong>BDD</strong> interface before loading the test scripts, running them <code>onload</code> with <code>mocha.run()</code>.</p>
+
<pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href="style.css" /&gt;
&lt;script src="../mocha.js"&gt;&lt;/script&gt;
@@ -289,7 +294,7 @@ Options:
&lt;script&gt;onload = mocha.run;&lt;/script&gt;
</code></pre>
-<h3>mocha.opts</h3>
+<h2>mocha.opts</h2>
<p>Mocha will attempt to load <code>./test/mocha.opts</code>, these are concatenated with <code>process.argv</code>, though command-line args will take precedence. For example suppose you have the following <em>mocha.opts</em> file:</p>
@@ -306,7 +311,7 @@ Options:
<pre><code>$ mocha --reporter list --growl
</code></pre>
-<h3>Suite merging</h3>
+<h2>Suite merging</h2>
<p>Suites with common names are "merged" in order
to produce unified reporting, especially when
@@ -335,7 +340,7 @@ describe('merge stuff', function(){
})
</code></pre>
-<p>will produce the following:</p>
+<p>Instead of reporting these as distinct suites, they are merged, yielding the following: </p>
<p><img src="http://f.cl.ly/items/380R3S1t1t0b0O2K250V/Screenshot.png" alt="mocha suite merging" title="" /></p>
diff --git a/index.md b/index.md
index 92b671cd..08721cce 100644
--- a/index.md
+++ b/index.md
@@ -245,11 +245,16 @@ Testing asynchronous code with Mocha could not be simpler! Simply invoke the cal
</dl>
</section>
-### Browser support
+### HTML
- Mocha runs in the browser. Every release of Mocha will have new builds of _./mocha.js_ and _./mocha.css_ for use in the browser. To setup Mocha for browser use all you have to do is include the script, stylesheet, tell Mocha which interface you wish to use, and then run the tests. A typical setup might look something like the following, where we call `mocha.setup('bdd')` to use the __BDD__ interface before loading the test scripts, running them `onload` with `mocha.run()`.
+ The __HTML__ reporter is currently the only browser reporter
+ supported by Mocha, and it looks like this:
- ![HTML test reporter](images/reporter-html.png)
+ ![HTML test reporter](images/reporter-html.png)
+
+## Browser support
+
+ Mocha runs in the browser. Every release of Mocha will have new builds of _./mocha.js_ and _./mocha.css_ for use in the browser. To setup Mocha for browser use all you have to do is include the script, stylesheet, tell Mocha which interface you wish to use, and then run the tests. A typical setup might look something like the following, where we call `mocha.setup('bdd')` to use the __BDD__ interface before loading the test scripts, running them `onload` with `mocha.run()`.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="style.css" />
@@ -260,7 +265,7 @@ Testing asynchronous code with Mocha could not be simpler! Simply invoke the cal
<script src="test.xhr.js"></script>
<script>onload = mocha.run;</script>
-### mocha.opts
+## mocha.opts
Mocha will attempt to load `./test/mocha.opts`, these are concatenated with `process.argv`, though command-line args will take precedence. For example suppose you have the following _mocha.opts_ file:
@@ -275,7 +280,7 @@ Testing asynchronous code with Mocha could not be simpler! Simply invoke the cal
$ mocha --reporter list --growl
-### Suite merging
+## Suite merging
Suites with common names are "merged" in order
to produce unified reporting, especially when
@@ -303,7 +308,7 @@ Testing asynchronous code with Mocha could not be simpler! Simply invoke the cal
})
})
-will produce the following:
+Instead of reporting these as distinct suites, they are merged, yielding the following:
![mocha suite merging](http://f.cl.ly/items/380R3S1t1t0b0O2K250V/Screenshot.png)