-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.html
45 lines (40 loc) · 1.31 KB
/
tests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE 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/babel-polyfill/dist/polyfill.min.js"></script>
<script src="node_modules/mocha/mocha.js"></script>
<script src="node_modules/expect.js/index.js"></script>
<script src="dist/js/set-functions.min.js"></script>
<script>mocha.setup('bdd')</script>
<script src="test/tests.js"></script>
<script>
window.onload = function(){
mocha.checkLeaks();
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>