From: Andreas Lind Date: Mon, 22 May 2017 07:17:18 +0000 (+0200) Subject: grunt qunit: Don't break in JSON.parse when debug output is generated while running... X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f93c597665d5639785358a578961bf49e10ffc7b;p=html-minifier.git grunt qunit: Don't break in JSON.parse when debug output is generated while running the test suite --- diff --git a/Gruntfile.js b/Gruntfile.js index caf4790..6bdbfb4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -141,7 +141,15 @@ module.exports = function(grunt) { errors.push(-1); } else { - errors.push(report(testType, JSON.parse(result.stdout))); + var output = result.stdout; + var index = output.lastIndexOf('\n'); + if (index !== -1) { + // There's something before the report JSON + // Log it to the console -- it's probably some debug output: + console.log(output.slice(0, index)); + output = output.slice(index); + } + errors.push(report(testType, JSON.parse(output))); } if (errors.length === 2) { done(!errors[0] && !errors[1]);