Skip to content

armgit / mocha

Public Imported from GitHub
0

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

fixed markdown TOC links

TJ Holowaychuk33be8d3e1bc8
diff --git a/lib/reporters/markdown.js b/lib/reporters/markdown.js
index a54b8d9a..7eeae856 100644
--- a/lib/reporters/markdown.js
+++ b/lib/reporters/markdown.js
@@ -38,7 +38,7 @@ function Markdown(runner) {
function mapTOC(suite, obj) {
var ret = obj;
- obj = obj[suite.title] = obj[suite.title] || {};
+ obj = obj[suite.title] = obj[suite.title] || { suite: suite };
suite.suites.forEach(function(suite){
mapTOC(suite, obj);
});
@@ -50,7 +50,8 @@ function Markdown(runner) {
var buf = '';
var link;
for (var key in obj) {
- if (key) link = ' - [' + key + '](#' + utils.slug(key) + ')\n';
+ if ('suite' == key) continue;
+ if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
if (key) buf += Array(level).join(' ') + link;
buf += stringifyTOC(obj[key], level);
}