Skip to content

armgit / mocha

Public Imported from GitHub
0

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

report duration

Tj Holowaychukcbc49c5725be
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index cc968d01..b8d4b416 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -18,6 +18,7 @@ exports = module.exports = HTML;
var statsTemplate = '<ul id="stats">'
+ '<li class="passes">passes: <em>0</em></li>'
+ '<li class="failures">failures: <em>0</em></li>'
+ + '<li class="duration">duration: <em>0</em>ms</li>'
+ '</ul>';
/**
@@ -68,6 +69,7 @@ function HTML(runner) {
// update stats
stat.find('.passes em').text(stats.passes);
stat.find('.failures em').text(stats.failures);
+ stat.find('.duration em').text(new Date - stats.start);
// test
var str = test.passed ? 'pass' : 'fail';
diff --git a/mocha.js b/mocha.js
index 9d984339..e1e7c4d2 100644
--- a/mocha.js
+++ b/mocha.js
@@ -759,6 +759,7 @@ exports = module.exports = HTML;
var statsTemplate = '<ul id="stats">'
+ '<li class="passes">passes: <em>0</em></li>'
+ '<li class="failures">failures: <em>0</em></li>'
+ + '<li class="duration">duration: <em>0</em>ms</li>'
+ '</ul>';
/**
@@ -809,6 +810,7 @@ function HTML(runner) {
// update stats
stat.find('.passes em').text(stats.passes);
stat.find('.failures em').text(stats.failures);
+ stat.find('.duration em').text(new Date - stats.start);
// test
var str = test.passed ? 'pass' : 'fail';