1Mocha is a JavaScript test framework!
2
3var assert = require('assert');
4describe('Array', function () {
5 describe('#indexOf()', function () {
6 it('should return -1 when the value is not present', function () {
7 assert.equal([1, 2, 3].indexOf(4), -1);
8 });
9 });
10});
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <title>Mocha Tests</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
8 </head>
9 <body>
10 <div id="mocha"></div>
11
12 <script src="https://unpkg.com/chai/chai.js"></script>
13 <script src="https://unpkg.com/mocha/mocha.js"></script>
14
15 <script class="mocha-init">
16 mocha.setup('bdd');
17 mocha.checkLeaks();
18 </script>
19 <script src="test.array.js"></script>
20 <script src="test.object.js"></script>
21 <script src="test.xhr.js"></script>
22 <script class="mocha-exec">
23 mocha.run();
24 </script>
25 </body>
26</html>
27