javascript-logitio
Version:
javascript module to integrate with logit.io logging system
122 lines (100 loc) • 2.41 kB
HTML
<html>
<head>
<meta charset="utf-8">
<title>Logit IO javascript appender tests</title>
<link rel="stylesheet" media="all" href="./mocha/mocha.css">
<style>
#mocha .suite {
margin: 24px 0;
}
#mocha .suite > ul {
margin-left: 24px;
}
#mocha .suite .test:before {
font-size: 20px;
line-height: 24px;
}
#mocha .test.pending:hover h2:after {
line-height: 0;
margin-left: 1em;
}
#mocha h1 {
font-weight: bold;
font-size: 16px;
line-height: 24px;
margin: 24px 0;
}
#mocha h2 {
font-size: 16px;
line-height: 24px;
margin: 0;
}
#mocha .suite h1 {
font-size: 20px;
}
#mocha .suite h2 {
font-size: 18px;
}
#mocha .suite .suite h1 {
font-size: 18px;
}
#mocha .suite .suite h2 {
font-size: 16px;
}
#mocha .suite .suite .suite h1 {
font-size: 16px;
}
#mocha .suite .suite .suite h2 {
font-weight: normal;
}
#mocha .suite .suite .suite .suite h1 {
font-weight: normal;
}
</style>
</head>
<body>
<div id="mocha"><p><a href="./index.htm">Index</a></p></div>
<div id="messages"></div>
<div id="fixtures"></div>
<script src="./mocha/mocha.js"></script>
<script src="./sinon/pkg/sinon-1.14.1.js"></script>
<script src="./sinon/pkg/sinon-ie-1.14.1.js"></script>
<script src="./chai/chai.js"></script>
<script src="./sinon-chai/lib/sinon-chai.js"></script>
<script src="./json3/lib/json3.js"></script>
<script src="./logit.js" data-cover></script>
<script>mocha.setup( 'bdd' );</script>
<script src="./test.js"></script>
<script>
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>