diff --git a/README.md b/README.md index 30c6378..837cc3e 100644 --- a/README.md +++ b/README.md @@ -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.* diff --git a/tasks/jasmine.js b/tasks/jasmine.js index b6a3772..21214ea 100644 --- a/tasks/jasmine.js +++ b/tasks/jasmine.js @@ -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)+')';