diff --git a/alcotest/junit_alcotest.ml b/alcotest/junit_alcotest.ml index 1cd1d31..1a76dbd 100644 --- a/alcotest/junit_alcotest.ml +++ b/alcotest/junit_alcotest.ml @@ -50,9 +50,65 @@ let wrap_test ?classname handle_result (name, s, test) = name, s, test ;; -let run ?argv name tl = A.run ~and_exit:false ?argv name tl +let run + ?stdout + ?stderr + ?verbose + ?compact + ?tail_errors + ?quick_only + ?show_errors + ?json + ?filter + ?log_dir + ?bail + ?record_backtrace + ?ci + ?argv + name + tests + = + A.run + ?stdout + ?stderr + ?verbose + ?compact + ?tail_errors + ?quick_only + ?show_errors + ?json + ?filter + ?log_dir + ?bail + ?record_backtrace + ?ci + ?argv + ~and_exit:false + name + tests +;; -let run_and_report ?(and_exit = true) ?package ?timestamp ?argv name tests = +let run_and_report + ?(and_exit = true) + ?package + ?timestamp + ?stdout + ?stderr + ?verbose + ?compact + ?tail_errors + ?quick_only + ?show_errors + ?json + ?filter + ?log_dir + ?bail + ?record_backtrace + ?ci + ?argv + name + tests + = let testcases = ref [] in let testsuite = Junit.Testsuite.make ?package ?timestamp ~name () in let tests = @@ -64,7 +120,23 @@ let run_and_report ?(and_exit = true) ?package ?timestamp ?argv name tests = in let exit = try - run ?argv name tests; + run + ?stdout + ?stderr + ?verbose + ?compact + ?tail_errors + ?quick_only + ?show_errors + ?json + ?filter + ?log_dir + ?bail + ?record_backtrace + ?ci + ?argv + name + tests; fun () -> if and_exit then exit 0 else () with | A.Test_error as exn -> fun () -> if and_exit then exit 1 else reraise exn diff --git a/alcotest/junit_alcotest.mli b/alcotest/junit_alcotest.mli index 515bfa7..e208603 100644 --- a/alcotest/junit_alcotest.mli +++ b/alcotest/junit_alcotest.mli @@ -21,12 +21,29 @@ val wrap_test -> unit Alcotest.test_case -> unit Alcotest.test_case -(** [run ?argv n t] is a wrapper around {!Alcotest.run}, only setting +(** [run n t] is a wrapper around {!Alcotest.run}, only setting [and_exit] to false. It is mandatory to be able to process results after the end of the run. Low level function. It is easier to use {!run_and_report}. *) -val run : ?argv:string array -> string -> unit Alcotest.test list -> unit +val run + : ?stdout:Alcotest_engine.Formatters.stdout + -> ?stderr:Alcotest_engine.Formatters.stderr + -> ?verbose:bool + -> ?compact:bool + -> ?tail_errors:[ `Limit of int | `Unlimited ] + -> ?quick_only:bool + -> ?show_errors:bool + -> ?json:bool + -> ?filter:(name:string -> index:int -> [ `Run | `Skip ]) + -> ?log_dir:string + -> ?bail:bool + -> ?record_backtrace:bool + -> ?ci:Alcotest_engine__Config.ci + -> ?argv:string array + -> string + -> unit Alcotest.test list + -> unit (** [exit ()] exits with appropriate code if {!run_and_report}'s [and_exit] was [true] or raise {!Alcotest.Test_error} in case of @@ -52,6 +69,19 @@ val run_and_report : ?and_exit:bool -> ?package:string -> ?timestamp:Ptime.t + -> ?stdout:Alcotest_engine.Formatters.stdout + -> ?stderr:Alcotest_engine.Formatters.stderr + -> ?verbose:bool + -> ?compact:bool + -> ?tail_errors:[ `Limit of int | `Unlimited ] + -> ?quick_only:bool + -> ?show_errors:bool + -> ?json:bool + -> ?filter:(name:string -> index:int -> [ `Run | `Skip ]) + -> ?log_dir:string + -> ?bail:bool + -> ?record_backtrace:bool + -> ?ci:Alcotest_engine__Config.ci -> ?argv:string array -> string -> (string * unit Alcotest.test_case list) list diff --git a/alcotest/test/alcotest_report.expected b/alcotest/test/alcotest_report.expected index cd0c37c..072574f 100644 --- a/alcotest/test/alcotest_report.expected +++ b/alcotest/test/alcotest_report.expected @@ -1,12 +1,12 @@ Invalid_argument("7")Alcotest assertion failure -File "alcotest/junit_alcotest.ml", line 20, character 6: +File "alcotest/junit_alcotest.ml", line 22, character 6: FAIL string_of_int equals to '7' Expected: `"7"' Received: `"8"' Invalid_argument("7")Alcotest assertion failure -File "alcotest/junit_alcotest.ml", line 20, character 6: +File "alcotest/junit_alcotest.ml", line 22, character 6: FAIL string_of_int equals to '7' Expected: `"7"' diff --git a/junit_alcotest.opam b/junit_alcotest.opam index f8aa7d2..1f636b6 100644 --- a/junit_alcotest.opam +++ b/junit_alcotest.opam @@ -10,7 +10,7 @@ tags: ["junit" "jenkins" "alcotest"] depends: [ "dune" {>= "3.0"} "odoc" {with-doc & >= "1.1.1"} - "alcotest" {>= "1.7.0"} + "alcotest" {>= "1.8.0"} "junit" {= version} "ocamlformat" {= "0.27.0" & with-dev-setup} ]