@@ -64,30 +64,34 @@ async function executeJavaScriptTest<T>(js: string, expected?: T): Promise<T> {
64
64
}
65
65
66
66
export async function runTests ( ) {
67
- console . time ( 'runTests' ) ;
67
+ try {
68
+ console . time ( 'runTests' ) ;
68
69
69
- await executeJavaScriptTest ( 'console.log("test console from web view")' ) ;
70
- await executeJavaScriptTest ( 'callFromNativeScript()' ) ;
70
+ await executeJavaScriptTest ( 'console.log("test console from web view")' ) ;
71
+ await executeJavaScriptTest ( 'callFromNativeScript()' ) ;
71
72
72
- const expected = {
73
- huba : 'hop' ,
74
- } ;
75
- const gotJson = JSON . stringify ( gotMessageData ) ;
73
+ const expected = {
74
+ huba : 'hop' ,
75
+ } ;
76
+ const gotJson = JSON . stringify ( gotMessageData ) ;
76
77
77
- if ( fastEqual ( expected , gotMessageData ) ) {
78
- console . log ( `executeJavaScript via message 'callFromNativeScript()' => ${ gotJson } (${ typeof gotMessageData } )` ) ;
79
- } else {
80
- throw new Error ( `Expected: ${ JSON . stringify ( expected ) } . Got: ${ gotJson } ` ) ;
81
- }
78
+ if ( fastEqual ( expected , gotMessageData ) ) {
79
+ console . log ( `executeJavaScript via message 'callFromNativeScript()' => ${ gotJson } (${ typeof gotMessageData } )` ) ;
80
+ } else {
81
+ throw new Error ( `Expected: ${ JSON . stringify ( expected ) } . Got: ${ gotJson } ` ) ;
82
+ }
82
83
83
- await executeJavaScriptTest ( 'getNumber()' , 42 ) ;
84
- await executeJavaScriptTest ( 'getNumberFloat()' , 3.14 ) ;
85
- await executeJavaScriptTest ( 'getBoolean()' , false ) ;
86
- await executeJavaScriptTest ( 'getString()' , 'string result from webview JS function' ) ;
87
- await executeJavaScriptTest ( 'getArray()' , [ 1.5 , true , 'hello' ] ) ;
88
- await executeJavaScriptTest ( 'getObject()' , { name : 'object-test' , prop : 'test' , values : [ 42 , 3.14 ] } ) ;
84
+ await executeJavaScriptTest ( 'getNumber()' , 42 ) ;
85
+ await executeJavaScriptTest ( 'getNumberFloat()' , 3.14 ) ;
86
+ await executeJavaScriptTest ( 'getBoolean()' , false ) ;
87
+ await executeJavaScriptTest ( 'getString()' , 'string result from webview JS function' ) ;
88
+ await executeJavaScriptTest ( 'getArray()' , [ 1.5 , true , 'hello' ] ) ;
89
+ await executeJavaScriptTest ( 'getObject()' , { name : 'object-test' , prop : 'test' , values : [ 42 , 3.14 ] } ) ;
89
90
90
- console . timeEnd ( 'runTests' ) ;
91
+ console . timeEnd ( 'runTests' ) ;
92
+ } catch ( err ) {
93
+ console . error ( err ) ;
94
+ }
91
95
}
92
96
93
97
let closeFullscreen : ( ) => void ;
0 commit comments