forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exports.html
48 lines (42 loc) · 1.56 KB
/
exports.html
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
<!DOCTYPE html><html><head><title>Mocha - API documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="stylesheet" href="style.css"><script src="jquery.js"></script><script src="docs.js"></script></head><body><div id="content"><h1>Mocha</h1><div id="module.exports" class="comment"><h2>module.exports()</h2><div class="description"><p>TDD-style interface:</p>
<pre><code>exports.Array = {
'#indexOf()': {
'should return -1 when the value is not present': function(){
},
'should return the correct index when the value is present': function(){
}
}
};
</code></pre></div><h3>Source</h3><pre><code>module.exports = function(suite){
var suites = [suite];
suite.on('require', visit);
function visit(obj) {
var suite;
for (var key in obj) {
if ('function' == typeof obj[key]) {
var fn = obj[key];
switch (key) {
case 'before':
suites[0].beforeAll(fn);
break;
case 'after':
suites[0].afterAll(fn);
break;
case 'beforeEach':
suites[0].beforeEach(fn);
break;
case 'afterEach':
suites[0].afterEach(fn);
break;
default:
suites[0].addTest(new Test(key, fn));
}
} else {
var suite = Suite.create(suites[0], key);
suites.unshift(suite);
visit(obj[key]);
suites.shift();
}
}
}
};</code></pre></div></div><ul id="menu"><li><a href="#module.exports">module.exports()</a></li></ul></body></html>