mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Rereun-each fix (#23168)
### What does this PR do? Fix --rerun-each. Fixes #21409 ### How did you verify your code works? Test case --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1828,6 +1828,13 @@ pub const TestCommand = struct {
|
||||
vm.onUnhandledRejection = jest.on_unhandled_rejection.onUnhandledRejection;
|
||||
|
||||
while (repeat_index < repeat_count) : (repeat_index += 1) {
|
||||
// Clear the module cache before re-running (except for the first run)
|
||||
if (repeat_index > 0) {
|
||||
try vm.clearEntryPoint();
|
||||
var entry = jsc.ZigString.init(file_path);
|
||||
try vm.global.deleteModuleRegistryEntry(&entry);
|
||||
}
|
||||
|
||||
var bun_test_root = &jest.Jest.runner.?.bun_test_root;
|
||||
// Determine if this file should run tests concurrently based on glob pattern
|
||||
const should_run_concurrent = reporter.jest.shouldFileRunConcurrently(file_id);
|
||||
@@ -1838,7 +1845,10 @@ pub const TestCommand = struct {
|
||||
|
||||
bun.jsc.Jest.bun_test.debug.group.log("loadEntryPointForTestRunner(\"{}\")", .{std.zig.fmtEscapes(file_path)});
|
||||
var promise = try vm.loadEntryPointForTestRunner(file_path);
|
||||
reporter.summary().files += 1;
|
||||
// Only count the file once, not once per repeat
|
||||
if (repeat_index == 0) {
|
||||
reporter.summary().files += 1;
|
||||
}
|
||||
|
||||
switch (promise.status(vm.global.vm())) {
|
||||
.rejected => {
|
||||
@@ -1905,11 +1915,6 @@ pub const TestCommand = struct {
|
||||
}
|
||||
|
||||
vm.global.handleRejectedPromises();
|
||||
if (repeat_index > 0) {
|
||||
try vm.clearEntryPoint();
|
||||
var entry = jsc.ZigString.init(file_path);
|
||||
try vm.global.deleteModuleRegistryEntry(&entry);
|
||||
}
|
||||
|
||||
if (Output.is_github_action) {
|
||||
Output.prettyErrorln("<r>\n::endgroup::\n", .{});
|
||||
|
||||
Reference in New Issue
Block a user