Skip to content

armgit / mocha

Public Imported from GitHub
0

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

docs for browser support

TJ Holowaychuk74498d49b001
diff --git a/index.md b/index.md
index 779a5677..20ad6382 100644
--- a/index.md
+++ b/index.md
@@ -248,6 +248,19 @@ Testing asynchronous code with Mocha could not be simpler! Simply invoke the cal
</dl>
</section>
+### 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" />
+ <script src="../mocha.js"></script>
+ <script>mocha.setup('bdd')</script>
+ <script src="test.array.js"></script>
+ <script src="test.object.js"></script>
+ <script src="test.xhr.js"></script>
+ <script>onload = mocha.run;</script>
+
### 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: