Simplify test/unittests.html removing old stuff related to phantomjs

This commit is contained in:
Giovanni Pellerano 2016-06-26 11:35:43 +02:00
parent ee22c023f1
commit f8c5c84469

View File

@ -20,33 +20,28 @@
</script>
<script src="lib/unittests-bundle.js"></script>
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
var runner = mocha.run();
var runner = mocha.run();
var failedTests = [];
var failedTests = [];
runner.on('end', function(){
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});
runner.on('end', function(){
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});
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();
};
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)});
};
failedTests.push({name: test.title, result: false, message: err.message, stack: err.stack, titles: flattenTitles(test)});
};
runner.on('fail', logFailure);
}
runner.on('fail', logFailure);
</script>
</body>
</html>