From 37f79d242b104bfb80b3152a2ee86e105be251a3 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Mon, 3 Dec 2012 21:39:10 -0800 Subject: [PATCH] throw test passes --- lib/test.js | 9 +++++++-- test/throw.js | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/test.js b/lib/test.js index 7d8c21c7..7acf6f29 100644 --- a/lib/test.js +++ b/lib/test.js @@ -37,10 +37,15 @@ function Test (name_, opts_, cb_) { Test.prototype.run = function () { if (this._skip) { - this.end(); - } else { + return this.end(); + } + try { this._cb(this); } + catch (err) { + this.error(err); + this.end(); + } }; Test.prototype.test = function (name, opts, cb) { diff --git a/test/throw.js b/test/throw.js index 03d29d7d..99844a05 100644 --- a/test/throw.js +++ b/test/throw.js @@ -5,7 +5,7 @@ var tap = require('tap'); tap.test('throw test', function (tt) { tt.plan(1); - var test = tape.createHarness(); + var test = tape.createHarness({ exit : false }); var tc = tap.createConsumer(); var rows = []; @@ -20,11 +20,11 @@ tap.test('throw test', function (tt) { tt.same(rs, [ 'TAP version 13', 'thrower', - { id: 1, ok: true, name: 'should be equivalent' }, - { id: 2, ok: false, name: 'Error: rawr' }, + { id: 1, ok: true, name: 'should be equal' }, + { id: 2, ok: false, name: 'rawr' }, 'tests 2', - 'pass 1', - 'fail 1', + 'pass 1', + 'fail 1', ]); });