-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_coverage.ab
More file actions
executable file
·48 lines (33 loc) · 1.17 KB
/
run_coverage.ab
File metadata and controls
executable file
·48 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env amber
import { env_var_set, env_var_get } from "std/env"
import { starts_with } from "std/text"
fun open_html_report() {
let os = trust env_var_get("OSTYPE")
let open_html_command = "start" // windows command
if {
starts_with(os, "linux"): open_html_command = "xdg-open"
starts_with(os, "darwin"): open_html_command = "open"
}
let cov_file_path = "coverage_output/tarpaulin-report.html"
echo "Coverage results can be seen at {cov_file_path}"
trust $ {open_html_command} {cov_file_path} $
}
main(specified_output_formats) {
// Ensure necessary components are installed
silent $ cargo tarpaulin -V $ failed {
$ cargo install cargo-tarpaulin $?
}
trust env_var_set("CARGO_TARPAULIN_CONFIG_FILE", "./Tarpaulin.toml")
let output_format = "Html"
// First arg is "bash"
if len(specified_output_formats) > 1 {
output_format = specified_output_formats[1]
}
// Running code coverage analysis
trust $ cargo tarpaulin -o {output_format} $
let coverage_result_status = status
if output_format == "Html" {
open_html_report()
}
exit coverage_result_status
}