Skip to main content

xtask/
coverage.rs

1use anyhow::Result;
2use xshell::Shell;
3
4use crate::Config;
5use crate::commands::cargo_cmd;
6use crate::utils::{project_root, verbose_cd};
7
8pub fn html_report(config: &Config) -> Result<()> {
9    let sh = Shell::new()?;
10    verbose_cd(&sh, project_root());
11
12    let cmd_option = cargo_cmd(config, &sh);
13    if let Some(cmd) = cmd_option {
14        let args = vec![
15            "llvm-cov",
16            "nextest",
17            "--ignore-filename-regex",
18            "xtask",
19            "--open",
20        ];
21        cmd.args(args).run()?;
22    }
23
24    Ok(())
25}
26
27pub fn report_summary(config: &Config) -> Result<()> {
28    let sh = Shell::new()?;
29    verbose_cd(&sh, project_root());
30
31    let cmd_option = cargo_cmd(config, &sh);
32    if let Some(cmd) = cmd_option {
33        let args = vec!["llvm-cov", "nextest", "--ignore-filename-regex", "xtask"];
34        cmd.args(args).run()?;
35    }
36
37    Ok(())
38}