Skip to content

Commit

Permalink
Merge pull request #1174 from gaye/issue-950
Browse files Browse the repository at this point in the history
Issue 950 - Export file on Mocha.Test objects
  • Loading branch information
tj committed Mar 28, 2014
2 parents 780086b + 3dd1cdb commit 64396af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/interfaces/bdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ module.exports = function(suite){
var suite = suites[0];
if (suite.pending) var fn = null;
var test = new Test(title, fn);
test.file = file;
suite.addTest(test);
return test;
};
Expand Down
6 changes: 4 additions & 2 deletions lib/interfaces/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function(suite){

suite.on('require', visit);

function visit(obj) {
function visit(obj, file) {
var suite;
for (var key in obj) {
if ('function' == typeof obj[key]) {
Expand All @@ -47,7 +47,9 @@ module.exports = function(suite){
suites[0].afterEach(fn);
break;
default:
suites[0].addTest(new Test(key, fn));
var test = new Test(key, fn);
test.file = file;
suites[0].addTest(test);
}
} else {
var suite = Suite.create(suites[0], key);
Expand Down
1 change: 1 addition & 0 deletions lib/interfaces/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module.exports = function(suite){

context.test = function(title, fn){
var test = new Test(title, fn);
test.file = file;
suites[0].addTest(test);
return test;
};
Expand Down
1 change: 1 addition & 0 deletions lib/interfaces/tdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module.exports = function(suite){
var suite = suites[0];
if (suite.pending) var fn = null;
var test = new Test(title, fn);
test.file = file;
suite.addTest(test);
return test;
};
Expand Down

0 comments on commit 64396af

Please sign in to comment.