forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-stream.html
29 lines (24 loc) · 1.42 KB
/
json-stream.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
<!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="List" class="comment"><h2>List()</h2><div class="description"><p>Initialize a new <code>List</code> test reporter.</p></div><h3>Source</h3><pre><code>function List(runner) {
Base.call(this, runner);
var self = this
, stats = this.stats
, total = runner.total;
runner.on('start', function(){
console.log(JSON.stringify(['start', { total: total }]));
});
runner.on('pass', function(test){
console.log(JSON.stringify(['pass', clean(test)]));
});
runner.on('fail', function(test, err){
console.log(JSON.stringify(['fail', clean(test)]));
});
runner.on('end', function(){
process.stdout.write(JSON.stringify(['end', self.stats]));
});
}</code></pre></div><div id="clean" class="comment"><h2>clean()</h2><div class="description"><p>Return a plain-object representation of <code>test</code><br />free of cyclic properties etc.</p></div><h3>Source</h3><pre><code>function clean(test) {
return {
title: test.title
, fullTitle: test.fullTitle()
, duration: test.duration
}
}</code></pre></div></div><ul id="menu"><li><a href="#List">List()</a></li><li><a href="#clean">clean()</a></li></ul></body></html>