File tree 6 files changed +94
-7
lines changed
6 files changed +94
-7
lines changed Original file line number Diff line number Diff line change 92
92
}
93
93
}
94
94
95
- this . formData = function ( ) {
96
- var rejected = consumed ( this )
97
- return rejected ? rejected : Promise . resolve ( decode ( this . _body ) )
95
+ if ( self . FormData ) {
96
+ this . formData = function ( ) {
97
+ var rejected = consumed ( this )
98
+ return rejected ? rejected : Promise . resolve ( decode ( this . _body ) )
99
+ }
98
100
}
99
101
100
102
this . json = function ( ) {
Original file line number Diff line number Diff line change 22
22
"Headers" : false ,
23
23
"Request" : false ,
24
24
"Response" : false ,
25
+ "mocha" : false ,
26
+ "chai" : false ,
25
27
"suite" : false ,
26
28
"test" : false ,
27
29
"assert" : false
Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ server_pid=$!
12
12
trap " kill $server_pid " INT EXIT
13
13
14
14
node ./node_modules/.bin/mocha-phantomjs -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false " http://localhost:$port /test/test.html"
15
+ node ./node_modules/.bin/mocha-phantomjs -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false " http://localhost:$port /test/test-worker.html"
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < title > Fetch Worker Tests</ title >
6
+ < link rel ="stylesheet " href ="../node_modules/mocha/mocha.css " />
7
+ </ head >
8
+ < body >
9
+ < div id ="mocha "> </ div >
10
+ < script src ="../node_modules/mocha/mocha.js "> </ script >
11
+
12
+ < script >
13
+ mocha . setup ( 'tdd' )
14
+
15
+ var worker = new Worker ( 'worker.js' )
16
+
17
+ worker . addEventListener ( 'message' , function ( e ) {
18
+ switch ( e . data . name ) {
19
+ case 'pass' :
20
+ test ( e . data . title , function ( ) { } )
21
+ break
22
+ case 'pending' :
23
+ test ( e . data . title )
24
+ break
25
+ case 'fail' :
26
+ test ( e . data . title , function ( ) {
27
+ var err = new Error ( e . data . message )
28
+ err . stack = e . data . stack
29
+ throw err
30
+ } )
31
+ break
32
+ case 'end' :
33
+ if ( self . mochaPhantomJS ) {
34
+ mochaPhantomJS . run ( )
35
+ } else {
36
+ mocha . run ( )
37
+ }
38
+ break
39
+ }
40
+ } )
41
+ </ script >
42
+ </ body >
43
+ </ html >
Original file line number Diff line number Diff line change 10
10
< script src ="../node_modules/chai/chai.js "> </ script >
11
11
< script src ="../node_modules/mocha/mocha.js "> </ script >
12
12
< script >
13
- mocha . setup ( 'tdd' ) ;
14
- self . assert = chai . assert ;
13
+ mocha . setup ( 'tdd' )
14
+ self . assert = chai . assert
15
15
</ script >
16
16
17
17
< script src ="../bower_components/es6-promise/promise.js "> </ script >
21
21
22
22
< script >
23
23
if ( self . mochaPhantomJS ) {
24
- mochaPhantomJS . run ( ) ;
24
+ mochaPhantomJS . run ( )
25
25
} else {
26
- mocha . run ( ) ;
26
+ mocha . run ( )
27
27
}
28
28
</ script >
29
29
</ body >
Original file line number Diff line number Diff line change
1
+ importScripts ( '../node_modules/chai/chai.js' )
2
+ importScripts ( '../node_modules/mocha/mocha.js' )
3
+
4
+ mocha . setup ( 'tdd' )
5
+ self . assert = chai . assert
6
+
7
+ importScripts ( '../bower_components/es6-promise/promise.js' )
8
+ importScripts ( '../fetch.js' )
9
+
10
+ importScripts ( 'test.js' )
11
+
12
+ function title ( test ) {
13
+ return test . fullTitle ( ) . replace ( / # / g, '' ) ;
14
+ }
15
+
16
+ function reporter ( runner ) {
17
+ runner . on ( 'pending' , function ( test ) {
18
+ self . postMessage ( { name : 'pending' , title : title ( test ) } ) ;
19
+ } ) ;
20
+
21
+ runner . on ( 'pass' , function ( test ) {
22
+ self . postMessage ( { name : 'pass' , title : title ( test ) } ) ;
23
+ } ) ;
24
+
25
+ runner . on ( 'fail' , function ( test , err ) {
26
+ self . postMessage ( {
27
+ name : 'fail' ,
28
+ title : title ( test ) ,
29
+ message : err . message ,
30
+ stack : err . stack
31
+ } ) ;
32
+ } ) ;
33
+
34
+ runner . on ( 'end' , function ( ) {
35
+ self . postMessage ( { name : 'end' } ) ;
36
+ } ) ;
37
+ }
38
+
39
+ mocha . reporter ( reporter ) . run ( )
You can’t perform that action at this time.
0 commit comments