From c86ac6087603d75b3ab2f5fb3e7af03e26b89332 Mon Sep 17 00:00:00 2001 From: jonahss Date: Tue, 18 Feb 2014 16:14:31 -0800 Subject: [PATCH] updated grunt-saucelabs, failing tests revealed --- package.json | 2 +- spec/amd.html | 32 +++++++++++++++++++++++++++++++- spec/index.html | 32 +++++++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9bfc9575b..d7eb39aa0 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "grunt-contrib-requirejs": "~0.4.1", "grunt-contrib-uglify": "~0.2.2", "grunt-contrib-watch": "~0.5.3", - "grunt-saucelabs": "~4.1.2", + "grunt-saucelabs": "~5.0.1", "es6-module-packager": "1.x", "jison": "~0.3.0", "keen.io": "0.0.3", diff --git a/spec/amd.html b/spec/amd.html index a095650f4..ef33e61ea 100644 --- a/spec/amd.html +++ b/spec/amd.html @@ -62,11 +62,41 @@ window.Handlebars = Handlebars['default']; require(['tests'], function(Handlebars) { + mocha.globals(['mochaResults']) // The test harness leaks under FF. We should have decent global leak coverage from other tests if (!navigator.userAgent.match(/Firefox\/([\d.]+)/)) { mocha.checkLeaks(); } - mocha.run(); + var runner = mocha.run(); + + //Reporting for saucelabs + var failedTests = []; + runner.on('end', function(){ + window.mochaResults = runner.stats; + window.mochaResults.reports = failedTests; + }); + + runner.on('fail', logFailure); + + function logFailure(test, err){ + + var flattenTitles = function(test){ + var titles = []; + while (test.parent.title){ + titles.push(test.parent.title); + test = test.parent; + } + return titles.reverse(); + }; + + failedTests.push({ + name: test.title, + result: false, + message: err.message, + stack: err.stack, + titles: flattenTitles(test) + }); + }; }); }); }; diff --git a/spec/index.html b/spec/index.html index fe306e7f0..4a064cb5d 100644 --- a/spec/index.html +++ b/spec/index.html @@ -50,11 +50,41 @@