merged summary

This commit is contained in:
Christian Rondeau 2014-02-27 14:06:29 -08:00 committed by Jarrod Overson
parent 1123e03044
commit 1d43bf20e7
4 changed files with 33 additions and 3 deletions

View File

@ -63,6 +63,7 @@ module.exports = function(grunt) {
specs: 'test/fixtures/pivotal/spec/*Spec.js',
helpers: 'test/fixtures/pivotal/spec/*Helper.js',
display: 'short',
summary: true,
}
},
deepOutfile: {

View File

@ -149,6 +149,12 @@ Default: `full`
* `full` displays the full specs tree
* `short` only displays a success or failure character for each test (useful with large suites)
#### options.summary
Type: `Boolean`
Default: `false`
Display a list of all failed tests and their failure messages
### Flags
Name: `build`
@ -273,4 +279,4 @@ for more information on the RequireJS template.
Task submitted by [Jarrod Overson](http://jarrodoverson.com)
*This file was generated on Wed Feb 26 2014 15:21:40.*
*This file was generated on Wed Feb 26 2014 15:19:14.*

View File

@ -98,6 +98,12 @@ Default: `full`
* `full` displays the full specs tree
* `short` only displays a success or failure character for each test (useful with large suites)
## options.summary
Type: `Boolean`
Default: `false`
Display a list of all failed tests and their failure messages
# Flags
Name: `build`

View File

@ -25,6 +25,8 @@ module.exports = function(grunt) {
var status = {};
var summary = [];
var symbols = {
short : {
check : '.',
@ -71,7 +73,8 @@ module.exports = function(grunt) {
templateOptions : {},
junit : {},
ignoreEmpty: grunt.option('force') === true,
display: 'full'
display: 'full',
summary: false,
});
if (grunt.option('debug')) {
@ -260,6 +263,15 @@ module.exports = function(grunt) {
specSummary.failureMessages = specMetaData.failedExpectations.map(function(error){
return error.message;
});
summary.push({
suite: suites[currentSuite].name,
name: specMetaData.description,
errors: specMetaData.failedExpectations.map(function(error){
return {
message: error.message
};
})
});
} else {
thisRun.skippedSpecs++;
}
@ -322,6 +334,11 @@ module.exports = function(grunt) {
grunt.log.writeln();
}
if(options.summary && summary.length) {
grunt.log.writeln();
logSummary(summary);
}
if (options.junit && options.junit.path) {
writeJunitXml(suites);
}
@ -332,7 +349,7 @@ module.exports = function(grunt) {
function logSummary(tests) {
grunt.log.writeln('Summary (' + tests.length + ' tests failed)');
_.forEach(tests, function(test){
grunt.log.writeln(chalk.red(symbols[options.display]['error']) + ' ' + test.name);
grunt.log.writeln(chalk.red(symbols[options.display]['error']) + ' ' + test.suite + ' ' + test.name);
_.forEach(test.errors, function(error){
grunt.log.writeln(' ' + chalk.red(error.message));
});