Skip to content

Commit

Permalink
Comment formatting review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Millin committed Sep 8, 2016
1 parent c878a3a commit 4d63927
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ Test.prototype.test = function (name, opts, cb) {
});
};

Test.prototype.comment = function () {
Test.prototype.comment = function (msg) {
var that = this;
var keys = Object.keys(arguments)
var msg = keys.length > 1 ? format.apply(null, arguments) : arguments[keys[0]];

msg = arguments.length > 1 ? format.apply(null, arguments) : msg;

trim(msg).split('\n').forEach(function (aMsg) {
that.emit('result', trim(aMsg).replace(/^#\s*/, ''));
Expand Down
3 changes: 1 addition & 2 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ You may pass the same options that [`test()`](#testname-opts-cb) accepts.

## t.comment(message[, ...])

Print a message without breaking the tap output. Accepts optional args for `util.format`-style formatting.
(Useful when using e.g. `tap-colorize` where output is buffered & `console.log` will print in incorrect order vis-a-vis tap output.)
Print a message without breaking the tap output. Accepts optional args for `util.format`-style formatting. Useful when using e.g. `tap-colorize` where output is buffered & `console.log` will print in incorrect order vis-a-vis tap output.

## var htest = test.createHarness()

Expand Down
2 changes: 1 addition & 1 deletion test/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,4 @@ tap.test('formatted multiline string', function (assert) {
t.comment("tip\n%s\nt%s", "tap", "ape");
t.end();
});
});
});

0 comments on commit 4d63927

Please sign in to comment.