@@ -104,6 +104,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
104104 if (! res .success ) {
105105 return res ;
106106 }
107+ res .deinit (alloc );
107108
108109 // loop hover the scripts.
109110 const doc = parser .documentHTMLToDocument (html_doc );
@@ -124,6 +125,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
124125 if (! res .success ) {
125126 return res ;
126127 }
128+ res .deinit (alloc );
127129 }
128130
129131 // If the script as a source text, execute it.
@@ -134,6 +136,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
134136 if (! res .success ) {
135137 return res ;
136138 }
139+ res .deinit (alloc );
137140 }
138141
139142 // Mark tests as ready to run.
@@ -146,20 +149,26 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
146149 loadevt ,
147150 );
148151
152+ // wait for all async executions
153+ res = try js_env .waitTryCatch (alloc );
154+ if (! res .success ) {
155+ return res ;
156+ }
157+ res .deinit (alloc );
158+
149159 // Check the final test status.
150160 res = try evalJS (js_env , alloc , "report.status;" , "teststatus" );
151161 if (! res .success ) {
152162 return res ;
153163 }
164+ res .deinit (alloc );
154165
155166 // return the detailed result.
156167 return try evalJS (js_env , alloc , "report.log" , "teststatus" );
157168}
158169
159170fn evalJS (env : jsruntime.Env , alloc : std.mem.Allocator , script : []const u8 , name : ? []const u8 ) ! jsruntime.JSResult {
160- var res = jsruntime.JSResult {};
161- try env .run (alloc , script , name , & res , null );
162- return res ;
171+ return try env .execTryCatch (alloc , script , name );
163172}
164173
165174// browse the path to find the tests list.
0 commit comments