From f4aa6d93a75f899d8eb2990f50e97445064dd89d Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 17 May 2017 18:00:59 -0700 Subject: [PATCH] Capture and display browser logs when unit tests fail --- Gruntfile.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 15e8d5f0c..d3b789ec1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -379,9 +379,16 @@ module.exports = function(grunt) { failure = function() { grunt.fail.fatal('Found ' + results.failures + ' failing unit tests.'); }; + return app.client.log('browser'); } else { grunt.log.ok(results.passes + ' tests passed.'); } + }).then(function(logs) { + if (logs) { + console.error(); + console.error('Because tests failed, printing browser logs:'); + console.error(logs); + } }).catch(function (error) { failure = function() { grunt.fail.fatal('Something went wrong: ' + error.message + ' ' + error.stack);