mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
Ensure test with errors before JS execution exit with code 1 (#15321)
This commit is contained in:
@@ -1599,13 +1599,13 @@ pub const TestCommand = struct {
|
||||
|
||||
if (files.len > 1) {
|
||||
for (files[0 .. files.len - 1]) |file_name| {
|
||||
TestCommand.run(reporter, vm, file_name.slice(), allocator, false) catch {};
|
||||
TestCommand.run(reporter, vm, file_name.slice(), allocator, false) catch |err| handleTopLevelTestErrorBeforeJavaScriptStart(err);
|
||||
reporter.jest.default_timeout_override = std.math.maxInt(u32);
|
||||
Global.mimalloc_cleanup(false);
|
||||
}
|
||||
}
|
||||
|
||||
TestCommand.run(reporter, vm, files[files.len - 1].slice(), allocator, true) catch {};
|
||||
TestCommand.run(reporter, vm, files[files.len - 1].slice(), allocator, true) catch |err| handleTopLevelTestErrorBeforeJavaScriptStart(err);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1769,3 +1769,12 @@ pub const TestCommand = struct {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fn handleTopLevelTestErrorBeforeJavaScriptStart(err: anyerror) noreturn {
|
||||
if (comptime Environment.isDebug) {
|
||||
if (err != error.ModuleNotFound) {
|
||||
Output.debugWarn("Unhandled error: {s}\n", .{@errorName(err)});
|
||||
}
|
||||
}
|
||||
Global.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user