☕️ Classic, reliable, trusted test framework for Node.js and the browser
buffer markdown output
TJ Holowaychuk7a74b83e5da3
diff --git a/lib/reporters/markdown.js b/lib/reporters/markdown.jsindex 7b459ccb..77408983 100644--- a/lib/reporters/markdown.js+++ b/lib/reporters/markdown.js@@ -25,7 +25,8 @@ function Markdown(runner) {var self = this, stats = this.stats, total = runner.total- , level = 0;+ , level = 0+ , buf = '';function title(str) {return Array(level).join('#') + ' ' + str;@@ -33,8 +34,8 @@ function Markdown(runner) {runner.on('suite', function(suite){++level;- console.log('<a name="' + utils.slug(suite.title) + '" />');- process.stdout.write(title(suite.title) + '\n');+ buf += '<a name="' + utils.slug(suite.title) + '" />' + '\n';+ buf += title(suite.title) + '\n';});runner.on('suite end', function(suite){@@ -43,10 +44,14 @@ function Markdown(runner) {runner.on('pass', function(test){var code = clean(test.fn.toString());- console.log('%s.', test.title);- process.stdout.write('\n```js');- process.stdout.write(code + '\n');- process.stdout.write('```\n\n');+ buf += test.title + '.\n';+ buf += '\n```js';+ buf += code + '\n';+ buf += '```\n\n';+ });++ runner.on('end', function(){+ process.stdout.write(buf);});}