Skip to content

Commit

Permalink
handle comment lines smarter
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 5, 2011
1 parent f59cff0 commit db5b034
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tap.js
Expand Up @@ -4,8 +4,12 @@ module.exports = tap

function tap (res, count, diag) {
if (typeof res === "string") {
return ("\n# "+res.trim().split(/\r?\n/).join("\n# ")+"\n")
.split("\n# \n").join("\n\n")
res = res.split(/\r?\n/).map(function (l) {
if (!l.trim()) return l.trim()
return "# " + l
}).join("\n")
if (res.substr(-1) !== "\n") res += "\n"
return res
}

if (!!process.env.TAP_NODIAG) diag = false
Expand Down

0 comments on commit db5b034

Please sign in to comment.