From 81d097caf73b07a5e84e62744d2f23d461949cfd Mon Sep 17 00:00:00 2001 From: brianc Date: Thu, 14 Oct 2010 00:06:09 -0500 Subject: [PATCH] some test runner improvements --- test/unit/test-helper.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/unit/test-helper.js b/test/unit/test-helper.js index b9371fe2..36ecfd19 100644 --- a/test/unit/test-helper.js +++ b/test/unit/test-helper.js @@ -35,6 +35,14 @@ assert.length = function(actual, expectedLength) { assert.equal(actual.length, expectedLength); }; + +if(!global.TEST_RESULTS) { + global.TEST_RESULTS = { + testCount: 0, + assertCount: 0 + }; +} + test = function(name, action) { for(var i = 0; i < test.tabout; i++) { name = ' ' + name; @@ -42,6 +50,7 @@ test = function(name, action) { test.tabout += 2; process.stdout.write('.'); try{ + global.TEST_RESULTS.testCount++; action(); }catch(e) { console.log(name); @@ -50,6 +59,11 @@ test = function(name, action) { test.tabout -= 2; }; test.tabout = 0; +var start = new Date(); +process.on('exit', function() { + console.log(''); + console.log('Ran ' + global.TEST_RESULTS.testCount + ' tests in ' + ((new Date() - start)/1000) + ' seconds'); +}); stringToHex = function(string) { var b = Buffer(string,'utf8');