forked from JakeChampion/fetch
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest-worker.html
43 lines (40 loc) · 968 Bytes
/
test-worker.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Fetch Worker Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script>
mocha.setup('tdd')
var worker = new Worker('worker.js')
worker.addEventListener('message', function(e) {
switch (e.data.name) {
case 'pass':
test(e.data.title, function() {})
break
case 'pending':
test(e.data.title)
break
case 'fail':
test(e.data.title, function() {
var err = new Error(e.data.message)
err.stack = e.data.stack
throw err
})
break
case 'end':
if (self.mochaPhantomJS) {
mochaPhantomJS.run()
} else {
mocha.run()
}
break
}
})
</script>
</body>
</html>