Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recursion support to reporters #348

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/reporters/eclipse.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ exports.run = function (files, options, callback) {

nodeunit.runFiles(paths, {
testspec: undefined,
recursive: options.recursive,
moduleStart: function (name) {
console.log('\n' + name);
},
Expand Down
1 change: 1 addition & 0 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ exports.run = function (files, options, callback) {
nodeunit.runFiles(paths, {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
console.log('<h2>' + name + '</h2>');
console.log('<ol>');
Expand Down
3 changes: 2 additions & 1 deletion lib/reporters/junit.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ exports.run = function (files, opts, callback) {
nodeunit.runFiles(paths, {
testspec: opts.testspec,
testFullSpec: opts.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
curModule = {
errorCount: 0,
Expand Down Expand Up @@ -179,7 +180,7 @@ exports.run = function (files, opts, callback) {
' assertions (' + assertions.duration + 'ms)'
);
}

if (callback) callback(assertions.failures() ? new Error('We have got test failures.') : undefined);
});
});
Expand Down
5 changes: 3 additions & 2 deletions lib/reporters/lcov.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ exports.run = function (files, options, callback) {
var paths = files.map(function (p) {
return path.resolve(p);
});

nodeunit.runFiles(paths, {
recursive: options.recursive,
done: function (assertions) {
var cov = (global || window)._$jscoverage || {};

Object.keys(cov).forEach(function (filename) {
var data = cov[filename];
reportFile(filename, data);
});

if (callback) callback(assertions.failures() ? new Error('We have got test failures.') : undefined);
}
});
Expand Down
5 changes: 3 additions & 2 deletions lib/reporters/machineout.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ exports.run = function (files, options, callback) {
var names = tracker.names();
for (var i = 0; i < names.length; i += 1) {
console.log(createErrorMessage(
'Error', names[i],
'', '', '',
'Error', names[i],
'', '', '',
'Undone tests - To fix this, make sure all tests call test.done()'
));
}
Expand All @@ -86,6 +86,7 @@ exports.run = function (files, options, callback) {
nodeunit.runFiles(paths, {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {},
testDone: function (name, assertions) {
tracker.remove(name);
Expand Down
1 change: 1 addition & 0 deletions lib/reporters/minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ exports.run = function (files, options, callback) {
var opts = {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
process.stdout.write(bold(name) + ': ');
},
Expand Down
3 changes: 2 additions & 1 deletion lib/reporters/nested.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ exports.run = function (files, options, callback) {
nodeunit.runFiles(paths, {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
console.log('\n' + bold(name));
},
Expand Down Expand Up @@ -207,7 +208,7 @@ exports.run = function (files, options, callback) {
' assertions (' + assertions.duration + 'ms)'
);
}

if (callback) callback(assertions.failures() ? new Error('We have got test failures.') : undefined);
},
testStart: function (name) {
Expand Down
1 change: 1 addition & 0 deletions lib/reporters/skip_passed.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ exports.run = function (files, options, callback) {
nodeunit.runFiles(paths, {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
console.log('\n' + bold(name));
},
Expand Down
3 changes: 2 additions & 1 deletion lib/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ exports.run = function (files, options, callback) {
nodeunit.runFiles(paths, {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
recursive: options.recursive,
moduleStart: function (name) {
console.log('\n' + bold(name));
},
Expand Down Expand Up @@ -117,7 +118,7 @@ exports.run = function (files, options, callback) {
' assertions (' + assertions.duration + 'ms)'
);
}

if (callback) callback(assertions.failures() ? new Error('We have got test failures.') : undefined);
},
testStart: function(name) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"dependencies": {
"ejs": "^2.5.2",
"tap": "^10.0.2"
"tap": "^11.1.3"
},
"scripts": {
"test": "node ./bin/nodeunit"
Expand Down