operations
Version:
A library for managing complex chains of asynchronous operations in Javascript.
51 lines (45 loc) • 1.57 kB
HTML
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script src="../test/_.js"></script>
<script src="../node_modules/underscore/underscore.js"></script>
<script src="../build/operation.js"></script>
<script>mocha.setup('bdd')</script>
<!-- specs --><% specs.forEach( function ( file ) { %>
<script type="text/javascript" src="<%= file %>"></script>
<% }); %>
<script>
mocha.globals(['jQuery']);
onload = function(){
//mocha.checkLeaks();
//mocha.globals(['foo']);
var runner = mocha.run();
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>
</body>
</html>