fork-openpgpjs/test/unittests.html

53 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>OpenPGPJS Unit Tests</title>
<link rel="stylesheet" href="lib/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<!-- libs -->
<script src="../dist/openpgp.js"></script>
<script src="lib/chai.js"></script>
<script src="lib/mocha.js"></script>
<script src="lib/fetch.js"></script>
<script>
mocha.setup('bdd');
mocha.timeout(240000);
</script>
<script src="lib/unittests-bundle.js"></script>
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
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>