Skip to content

Commit

Permalink
Merge pull request #747 from Jonahss/master
Browse files Browse the repository at this point in the history
updated grunt-saucelabs, failing tests revealed
  • Loading branch information
kpdecker committed Feb 25, 2014
2 parents a5ff1f3 + c86ac60 commit fd5dfc8
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 31 additions & 1 deletion spec/amd.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
};
});
});
};
Expand Down
32 changes: 31 additions & 1 deletion spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,41 @@
<script src="/tmp/tests.js"></script>
<script>
onload = function(){
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)
});
};
};
</script>
</head>
Expand Down

0 comments on commit fd5dfc8

Please sign in to comment.