mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Prototype new test runner
Follows up on https://github.com/lightpanda-io/browser/pull/994 and replaces the jsRunner with a new page.navigation-based test runner. Currently only implemented for the Window tests, looking for feedback and converting every existing test will take time - so for a while, newRunner (to be renamed) will sit side-by-side with jsRunner. In addition to the benefits outlined in 994, largely around code simplicity and putting more of the actual code under tests, I think our WebAPI tests particularly benefit from: 1 - No need to recompile when modifying the html tests 2 - Much better assertions, e.g. you can assert that something is actually an array, not just a string representation of an array 3 - Ability to test some edge cases (e.g. dynamic script loading) I've put some effort into testing.js to make sure that, if the encapsulating zig test passes, it's because it actually passed, not because it didn't run. For the time being, console tests are removed. I think it's more useful to have access to the console within tests, than it is to test the console (which is just a wrapper around log, which is both tested and heavily used).
This commit is contained in:
11
src/main.zig
11
src/main.zig
@@ -725,8 +725,8 @@ var test_cdp_server: ?Server = null;
|
||||
var test_http_server: ?TestHTTPServer = null;
|
||||
|
||||
test "tests:beforeAll" {
|
||||
log.opts.level = .err;
|
||||
log.opts.format = .logfmt;
|
||||
log.opts.level = .warn;
|
||||
log.opts.format = .pretty;
|
||||
try testing.setup();
|
||||
var wg: std.Thread.WaitGroup = .{};
|
||||
wg.startMany(2);
|
||||
@@ -796,5 +796,12 @@ fn testHTTPHandler(req: *std.http.Server.Request) !void {
|
||||
});
|
||||
}
|
||||
|
||||
if (std.mem.startsWith(u8, path, "/src/browser/tests/")) {
|
||||
// strip off leading / so that it's relative to CWD
|
||||
return TestHTTPServer.sendFile(req, path[1..]);
|
||||
}
|
||||
|
||||
std.debug.print("TestHTTPServer was asked to serve an unknown file: {s}\n", .{path});
|
||||
|
||||
unreachable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user