mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
@@ -96,11 +96,15 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
\\console.log = function () {
|
\\console.log = function () {
|
||||||
\\ console.push(...arguments);
|
\\ console.push(...arguments);
|
||||||
\\};
|
\\};
|
||||||
|
\\console.debug = function () {
|
||||||
|
\\ console.push("debug", ...arguments);
|
||||||
|
\\};
|
||||||
;
|
;
|
||||||
res = try evalJS(js_env, alloc, init, "init");
|
res = try evalJS(js_env, alloc, init, "init");
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
res.deinit(alloc);
|
||||||
|
|
||||||
// loop hover the scripts.
|
// loop hover the scripts.
|
||||||
const doc = parser.documentHTMLToDocument(html_doc);
|
const doc = parser.documentHTMLToDocument(html_doc);
|
||||||
@@ -121,6 +125,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
res.deinit(alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the script as a source text, execute it.
|
// If the script as a source text, execute it.
|
||||||
@@ -131,6 +136,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
res.deinit(alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark tests as ready to run.
|
// Mark tests as ready to run.
|
||||||
@@ -143,20 +149,26 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
loadevt,
|
loadevt,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// wait for all async executions
|
||||||
|
res = try js_env.waitTryCatch(alloc);
|
||||||
|
if (!res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res.deinit(alloc);
|
||||||
|
|
||||||
// Check the final test status.
|
// Check the final test status.
|
||||||
res = try evalJS(js_env, alloc, "report.status;", "teststatus");
|
res = try evalJS(js_env, alloc, "report.status;", "teststatus");
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
res.deinit(alloc);
|
||||||
|
|
||||||
// return the detailed result.
|
// return the detailed result.
|
||||||
return try evalJS(js_env, alloc, "report.log", "teststatus");
|
return try evalJS(js_env, alloc, "report.log", "teststatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn evalJS(env: jsruntime.Env, alloc: std.mem.Allocator, script: []const u8, name: ?[]const u8) !jsruntime.JSResult {
|
fn evalJS(env: jsruntime.Env, alloc: std.mem.Allocator, script: []const u8, name: ?[]const u8) !jsruntime.JSResult {
|
||||||
var res = jsruntime.JSResult{};
|
return try env.execTryCatch(alloc, script, name);
|
||||||
try env.run(alloc, script, name, &res, null);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// browse the path to find the tests list.
|
// browse the path to find the tests list.
|
||||||
|
|||||||
2
vendor/zig-js-runtime
vendored
2
vendor/zig-js-runtime
vendored
Submodule vendor/zig-js-runtime updated: d4a2eaefd8...bb01609365
Reference in New Issue
Block a user