aboutsummaryrefslogtreecommitdiff
path: root/src/cli.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-03-19 19:07:56 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-03-19 19:07:56 -0700
commita83c5c996f46ae861962c8e8bf7042a8fa11130b (patch)
treec25496deb4cc04f19d8a50551a40c3c99b910e73 /src/cli.zig
parentb053dffca75848647286088e519e1e5a174e9d2e (diff)
downloadbun-a83c5c996f46ae861962c8e8bf7042a8fa11130b.tar.gz
bun-a83c5c996f46ae861962c8e8bf7042a8fa11130b.tar.zst
bun-a83c5c996f46ae861962c8e8bf7042a8fa11130b.zip
[bun test] Implement `--rerun-each` flag to run each test N times
Diffstat (limited to 'src/cli.zig')
-rw-r--r--src/cli.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cli.zig b/src/cli.zig
index 9b04a3588..1418d1b2e 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -217,6 +217,7 @@ pub const Arguments = struct {
// TODO: update test completions
const test_only_params = [_]ParamType{
clap.parseParam("--update-snapshots Update snapshot files") catch unreachable,
+ clap.parseParam("--rerun-each <NUMBER> Re-run each test file <NUMBER> times, helps catch certain bugs") catch unreachable,
};
const build_params_public = public_params ++ build_only_params;
@@ -376,6 +377,14 @@ pub const Arguments = struct {
if (cmd == .TestCommand) {
ctx.test_options.update_snapshots = args.flag("--update-snapshots");
+ if (args.option("--rerun-each")) |repeat_count| {
+ if (repeat_count.len > 0) {
+ ctx.test_options.repeat_count = std.fmt.parseInt(u32, repeat_count, 10) catch |e| {
+ Output.prettyErrorln("--rerun-each expects a number: {s}", .{@errorName(e)});
+ Global.exit(1);
+ };
+ }
+ }
}
ctx.args.absolute_working_dir = cwd;
@@ -871,6 +880,7 @@ pub const Command = struct {
pub const TestOptions = struct {
update_snapshots: bool = false,
+ repeat_count: u32 = 0,
};
pub const Context = struct {