@@ -77,11 +77,11 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
7777 defer js_env .stop ();
7878
7979 // load polyfills
80- try polyfill .load (alloc , js_env );
80+ try polyfill .load (alloc , & js_env );
8181
8282 // display console logs
8383 defer {
84- const res = evalJS (js_env , alloc , "console.join('\\ n');" , "console" ) catch unreachable ;
84+ const res = evalJS (& js_env , alloc , "console.join('\\ n');" , "console" ) catch unreachable ;
8585 defer res .deinit (alloc );
8686
8787 if (res .msg != null and res .msg .? .len > 0 ) {
@@ -104,7 +104,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
104104 \\ console.push("debug", ...arguments);
105105 \\};
106106 ;
107- var res = try evalJS (js_env , alloc , init , "init" );
107+ var res = try evalJS (& js_env , alloc , init , "init" );
108108 if (! res .ok ) return res ;
109109 res .deinit (alloc );
110110
@@ -123,14 +123,14 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
123123 path = try fspath .join (alloc , &.{ "/" , dirname , path });
124124 }
125125
126- res = try evalJS (js_env , alloc , try loader .get (path ), src );
126+ res = try evalJS (& js_env , alloc , try loader .get (path ), src );
127127 if (! res .ok ) return res ;
128128 res .deinit (alloc );
129129 }
130130
131131 // If the script as a source text, execute it.
132132 const src = try parser .nodeTextContent (s ) orelse continue ;
133- res = try evalJS (js_env , alloc , src , "" );
133+ res = try evalJS (& js_env , alloc , src , "" );
134134 if (! res .ok ) return res ;
135135 res .deinit (alloc );
136136 }
@@ -147,22 +147,22 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
147147
148148 // wait for all async executions
149149 var try_catch : jsruntime.TryCatch = undefined ;
150- try_catch .init (js_env );
150+ try_catch .init (& js_env );
151151 defer try_catch .deinit ();
152152 js_env .wait () catch {
153153 return .{
154154 .ok = false ,
155- .msg = try try_catch .err (alloc , js_env ),
155+ .msg = try try_catch .err (alloc , & js_env ),
156156 };
157157 };
158158
159159 // Check the final test status.
160- res = try evalJS (js_env , alloc , "report.status;" , "teststatus" );
160+ res = try evalJS (& js_env , alloc , "report.status;" , "teststatus" );
161161 if (! res .ok ) return res ;
162162 res .deinit (alloc );
163163
164164 // return the detailed result.
165- return try evalJS (js_env , alloc , "report.log" , "teststatus" );
165+ return try evalJS (& js_env , alloc , "report.log" , "teststatus" );
166166}
167167
168168pub const Res = struct {
@@ -176,7 +176,7 @@ pub const Res = struct {
176176 }
177177};
178178
179- fn evalJS (env : jsruntime.Env , alloc : std.mem.Allocator , script : []const u8 , name : ? []const u8 ) ! Res {
179+ fn evalJS (env : * const jsruntime.Env , alloc : std.mem.Allocator , script : []const u8 , name : ? []const u8 ) ! Res {
180180 var try_catch : jsruntime.TryCatch = undefined ;
181181 try_catch .init (env );
182182 defer try_catch .deinit ();
0 commit comments