forked from processing/p5.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
68 lines (57 loc) · 2.08 KB
/
test.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="mocha.css"/>
</head>
<body>
<!-- Required for browser reporter -->
<div id="mocha"></div>
<!-- mocha -->
<script src="../node_modules/mocha/mocha.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mocha_setup.js" type="text/javascript"></script>
<!-- Include your assertion lib of choice -->
<script src="../node_modules/chai/chai.js" type="text/javascript" ></script>
<script src="js/sinon.js" type="text/javascript" ></script>
<script src="js/modernizr.js" type="text/javascript" ></script>
<script src="js/chai_helpers.js" type="text/javascript" ></script>
<script src="js/p5_helpers.js" type="text/javascript" ></script>
<!-- Include anything you want to test -->
<script src="../lib/p5-test.js" type="text/javascript"></script>
<!-- Spec files (Now centralised in unit/spec.js) -->
<script src="unit/spec.js" type="text/javascript" ></script>
<!-- run mocha -->
<script type="text/javascript" >
p5._throwValidationErrors = true;
window.addEventListener('load', function() {
var runner = mocha.run();
// NOTE: Sauce Labs removed, keeping these for now
// This exposes our test results to Sauce Labs. For more
// details, see: https://github.com/axemclion/grunt-saucelabs.
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)
});
}
}, false);
</script>
</body>
</html>