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 @@