Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Added clickable suite titles to HTML reporter

Ian Storm Taylor8c6a4febbb66
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index c572205f..0bab4afc 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -76,7 +76,8 @@ function HTML(runner) {
if (suite.root) return;
// suite
- var el = fragment('<li class="suite"><h1>%s</h1></li>', suite.title);
+ var url = location.origin + location.pathname + '?grep=^' + utils.escapeRegexp(suite.fullTitle());
+ var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, suite.title);
// container
stack[0].appendChild(el);