From 0b795a0ce6ae4ac9b48473d521d65554d34ef0cd Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Tue, 24 Mar 2015 14:54:35 -0400 Subject: [PATCH] switch to mocha --- package.json | 5 ++++- test.js | 42 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index c25d6c1..d502f39 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "keywords": [ "process" ], + "scripts": { + "test": "mocha test.js" + }, "version": "0.10.1", "repository": { "type": "git", @@ -16,6 +19,6 @@ "node": ">= 0.6.0" }, "devDependencies": { - "tape": "^3.5.0" + "mocha": "2.2.1" } } diff --git a/test.js b/test.js index 9d4307d..d13380e 100644 --- a/test.js +++ b/test.js @@ -1,29 +1,29 @@ -var test = require('tape'); - var ourProcess = require('./browser'); +var assert = require('assert'); - -test('test errors', function (t) { - t.plan(7); - var order = 0; - process.once('uncaughtException', function(err) { - t.ok(true, err.message); - t.equals(2, order++, 'error is third'); +describe('test errors', function (t) { + it ('works', function (done) { + var order = 0; + process.removeAllListeners('uncaughtException'); + process.once('uncaughtException', function(err) { + assert.equal(2, order++, 'error is third'); + process.nextTick(function () { + assert.equal(5, order++, 'schedualed in error is last'); + done(); + }); + }); + process.nextTick(function () { + assert.equal(0, order++, 'first one works'); process.nextTick(function () { - t.equals(5, order++, 'schedualed in error is last'); + assert.equal(4, order++, 'recursive one is 4th'); }); - }); - process.nextTick(function () { - t.equals(0, order++, 'first one works'); + }); process.nextTick(function () { - t.equals(4, order++, 'recursive one is 4th'); + assert.equal(1, order++, 'second one starts'); + throw(new Error('an error is thrown')); + }); + process.nextTick(function () { + assert.equal(3, order++, '3rd schedualed happens after the error'); }); - }); - process.nextTick(function () { - t.equals(1, order++, 'second one starts'); - throw(new Error('an error is thrown')); - }); - process.nextTick(function () { - t.equals(3, order++, '3rd schedualed happens after the error'); }); });