Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Remove hasmark from TAP titles.

FARKAS Máté33d33c639ee7
diff --git a/lib/reporters/tap.js b/lib/reporters/tap.js
index e0087fe2..c7b6712f 100644
--- a/lib/reporters/tap.js
+++ b/lib/reporters/tap.js
@@ -37,11 +37,23 @@ function TAP(runner) {
});
runner.on('pass', function(test){
- console.log('ok %d %s', n, test.fullTitle());
+ console.log('ok %d %s', n, title(test));
});
runner.on('fail', function(test, err){
- console.log('not ok %d %s', n, test.fullTitle());
+ console.log('not ok %d %s', n, title(test));
console.log(err.stack.replace(/^/gm, ' '));
});
-}
\ No newline at end of file
+}
+
+/**
+ * Return a TAP-safe title of `test`
+ *
+ * @param {Object} test
+ * @return {String}
+ * @api private
+ */
+
+function title(test) {
+ return test.fullTitle().replace(/#/g, '');
+}