diff --git a/lib/mocha.js b/lib/mocha.js index fa9d5b6..1d66c62 100644 --- a/lib/mocha.js +++ b/lib/mocha.js @@ -4,25 +4,6 @@ var files = require('./files'); var async = require('async'); var path = require('path'); -/** - * Override some of bdd's post-require definitions in order to save file name in the test - * for xunit to output. - */ -var overrideBddIt = function(context, file, mocha) { - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - */ - - var oldIt = context.it; - context.it = context.specify = function(title, fn){ - var test = oldIt(title, fn); - test.file = file.replace(process.cwd(), ''); - return test; - }; - context.it.only = oldIt.only; -}; - function setupMocha(mochaOptions, mochaExports) { var mocha = new Mocha(mochaOptions); @@ -31,8 +12,6 @@ function setupMocha(mochaOptions, mochaExports) { _.each(_.isObject(mochaExports) ? mochaExports : {}, function(req, key) { context[key] = req; }); - - overrideBddIt(context, file, mocha); }); return mocha; @@ -54,7 +33,12 @@ function runMocha(mocha, testFile, done) { runner.on('fail', function(test, err){ if (process && process.send) { - process.send({status:'fail', file:test.file, title:test.title, message:err.message}); + process.send({ + status: 'fail', + file: test.file || test.parent && test.parent.file, + title: test.title, + message: err.message + }); } }); diff --git a/package.json b/package.json index b0620a0..013ae4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "triple-latte", - "version": "0.3.0", + "version": "0.4.0", "private": true, "author": { "name": "eleith",