forked from ServiceStack/servicestack-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testrunner.html
67 lines (58 loc) · 2.09 KB
/
testrunner.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
<!DOCTYPE html>
<html>
<head>
<title>Mocha Tests</title>
<link rel="stylesheet" href="node_modules/mocha/mocha.css">
</head>
<body>
<!-- run from http://localhost:8080/testrunner.html -->
<div id="mocha"></div>
<script src="node_modules/mocha/mocha.js"></script>
<script src="node_modules/chai/chai.js"></script>
<script>
if (typeof exports == "undefined")
window.exports = {};
var globalImports = {
chai: window.chai,
moch: window.mocha,
'fetch-everywhere': window.fetch,
eventsource: window.EventSource
};
//require shim
(function () {
// c is cache, the rest are the constants
var c = {},s="status",t="Text",e="exports",E="Error",r="require",m="module",S=" ",w=window;
w[r]=function R(url) {
if (globalImports[url])
return globalImports[url];
if (url.startsWith("./"))
url = "tests/" + url.substring(2);
url+=/.js$/i.test(url) ? "" : ".js";// to allow loading without js suffix;
var X=new XMLHttpRequest(),module = { id: url, uri: url }; //according to the modules 1.1 standard
if (!c[url])
try {
X.open("GET", url, 0); // sync
X.send();
if (X[s] && X[s] != 200)
throw X[s+t];
Function(r, e, m, X['response'+t])(R, c[url]={}, module); // Execute the module
module[e] && (c[url]=module[e]);
} catch (x) {
throw w[E](E+" in "+r+": Can't load "+m+S+url+":"+S+x);
}
return c[url];
}
})();
</script>
<script>mocha.setup('bdd')</script>
<!-- load code you want to test here -->
<script src="tests/client.spec.js"></script>
<script src="tests/client.auth.spec.js"></script>
<script src="tests/serverevents.spec.js"></script>
<script src="tests/utils.spec.js"></script>
<!-- load your test files here -->
<script>
mocha.run();
</script>
</body>
</html>