forked from JakeChampion/fetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
38 lines (30 loc) · 845 Bytes
/
worker.js
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
importScripts('/node_modules/chai/chai.js')
importScripts('/node_modules/mocha/mocha.js')
mocha.setup('tdd')
self.assert = chai.assert
importScripts('/bower_components/es6-promise/promise.js')
importScripts('/test/test.js')
importScripts('/fetch.js')
function title(test) {
return test.fullTitle().replace(/#/g, '');
}
function reporter(runner) {
runner.on('pending', function(test){
self.postMessage({name: 'pending', title: title(test)});
});
runner.on('pass', function(test){
self.postMessage({name: 'pass', title: title(test)});
});
runner.on('fail', function(test, err){
self.postMessage({
name: 'fail',
title: title(test),
message: err.message,
stack: err.stack
});
});
runner.on('end', function(){
self.postMessage({name: 'end'});
});
}
mocha.reporter(reporter).run()