diff --git a/test/integration/fixtures/regression/issue-1327.js b/test/integration/fixtures/regression/issue-1327.js index 5739edb465..43d5553762 100644 --- a/test/integration/fixtures/regression/issue-1327.js +++ b/test/integration/fixtures/regression/issue-1327.js @@ -1,11 +1,15 @@ it('test 1', function() { + console.log('testbody1'); process.nextTick(function() { throw 'Too bad'; }); }); -it('test 2', function() {}); +it('test 2', function() { + console.log('testbody2'); +}); it('test 3', function() { + console.log('testbody3'); throw new Error('OUCH'); }); diff --git a/test/integration/regression.js b/test/integration/regression.js index 494176da6a..564e922110 100644 --- a/test/integration/regression.js +++ b/test/integration/regression.js @@ -1,5 +1,5 @@ var assert = require('assert'); -var run = require('./helpers').runMochaJSON; +var run = require('./helpers').runMocha; describe('regressions', function() { this.timeout(1000); @@ -7,14 +7,16 @@ describe('regressions', function() { it('issue-1327: should run all 3 specs exactly once', function(done) { var args = []; run('regression/issue-1327.js', args, function(err, res) { + var occurences = function(str) { + var pattern = new RegExp(str, 'g'); + return (res.output.match(pattern) || []).length; + }; + assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 1); + assert.equal(occurences('testbody1'), 1); + assert.equal(occurences('testbody2'), 1); + assert.equal(occurences('testbody3'), 1); - assert.equal(res.passes[0].title, 'test 1'); - assert.equal(res.passes[1].title, 'test 2'); - assert.equal(res.failures[0].title, 'test 3'); assert.equal(res.code, 1); done(); });