Skip to content

Commit

Permalink
Merge pull request #149 from substack/if-error-assert
Browse files Browse the repository at this point in the history
Only check for errors in callback if exist
  • Loading branch information
Raynos committed Apr 2, 2015
2 parents 4b1e452 + 7329ddc commit 363b63f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/test.js
Expand Up @@ -122,7 +122,7 @@ Test.prototype.timeoutAfter = function(ms) {

Test.prototype.end = function (err) {
var self = this;
if (arguments.length >= 1) {
if (arguments.length >= 1 && !!err) {
this.ifError(err);
}

Expand Down
11 changes: 5 additions & 6 deletions test/end-as-callback.js
Expand Up @@ -19,13 +19,12 @@ tap.test("tape assert.end as callback", function (tt) {
"do a task and write",
{ id: 1, ok: true, name: "null" },
{ id: 2, ok: true, name: "should be equal" },
{ id: 3, ok: true, name: "null" },
"do a task and write fail",
{ id: 4, ok: true, name: "null" },
{ id: 5, ok: true, name: "should be equal" },
{ id: 6, ok: false, name: "Error: fail" },
"tests 6",
"pass 5",
{ id: 3, ok: true, name: "null" },
{ id: 4, ok: true, name: "should be equal" },
{ id: 5, ok: false, name: "Error: fail" },
"tests 5",
"pass 4",
"fail 1"
])

Expand Down

0 comments on commit 363b63f

Please sign in to comment.