accounted for non-terminal output, closes #110

This commit is contained in:
Jarrod Overson 2014-01-30 12:26:29 -08:00
parent 30ad17e4bc
commit 5ecc8fd961
2 changed files with 28 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# grunt-contrib-jasmine [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-jasmine.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jasmine)
# grunt-contrib-jasmine v0.6.0 [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-jasmine.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jasmine)
> Run jasmine specs headlessly through PhantomJS.
@ -266,4 +266,4 @@ for more information on the RequireJS template.
Task submitted by [Jarrod Overson](http://jarrodoverson.com)
*This file was generated on Wed Jan 29 2014 08:51:54.*
*This file was generated on Thu Jan 30 2014 12:05:09.*

View File

@ -153,6 +153,7 @@ module.exports = function(grunt) {
});
phantomjs.on('console', function(msg) {
thisRun.cleanConsole = false;
grunt.log.writeln('\n' + chalk.yellow('log: ') + msg);
});
@ -205,7 +206,8 @@ module.exports = function(grunt) {
phantomjs.on('jasmine.specStarted', function(specMetaData) {
thisRun.executedSpecs++;
grunt.log.write(indent(indentLevel) + '- ' + chalk.grey(specMetaData.description));
thisRun.cleanConsole = true;
grunt.log.write(indent(indentLevel) + '- ' + chalk.grey(specMetaData.description) + '...');
});
phantomjs.on('jasmine.specDone', function(specMetaData) {
@ -241,14 +243,29 @@ module.exports = function(grunt) {
suites[currentSuite].testcases.push(specSummary);
process.stdout.clearLine();
process.stdout.cursorTo(0);
grunt.log.writeln(
indent(indentLevel) +
chalk[color].bold(symbols[symbol]) + ' ' +
chalk.grey(specMetaData.description)
);
// If we're writing to a proper terminal, make it fancy.
if (process.stdout.clearLine) {
process.stdout.clearLine();
process.stdout.cursorTo(0);
grunt.log.writeln(
indent(indentLevel) +
chalk[color].bold(symbols[symbol]) + ' ' +
chalk.grey(specMetaData.description)
);
} else {
// If we haven't written out since we've started
if (thisRun.cleanConsole) {
// then append to the current line.
grunt.log.writeln('...' + symbols[symbol]);
} else {
// Otherwise reprint the current spec and status.
grunt.log.writeln(
indent(indentLevel) + '...' +
chalk.grey(specMetaData.description) + '...' +
symbols[symbol]
);
}
}
specMetaData.failedExpectations.forEach(function(error, i){
var specIndex = ' ('+(i+1)+')';