1pub mod webdriver;
4
5use crate::child;
6use crate::PBAR;
7use anyhow::{Context, Result};
8use std::ffi::OsStr;
9use std::path::Path;
10use std::process::Command;
11
12pub fn cargo_test_wasm<I, K, V>(
15 path: &Path,
16 release: bool,
17 envs: I,
18 extra_options: &[String],
19 target_triple: &str,
20) -> Result<()>
21where
22 I: IntoIterator<Item = (K, V)>,
23 K: AsRef<OsStr>,
24 V: AsRef<OsStr>,
25{
26 let mut cmd = Command::new("cargo");
27
28 cmd.envs(envs);
29 cmd.current_dir(path).arg("test");
30
31 if PBAR.quiet() {
32 cmd.arg("--quiet");
33 }
34
35 if release {
36 cmd.arg("--release");
37 }
38
39 cmd.arg("--target").arg(target_triple);
40
41 cmd.args(extra_options);
42
43 child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")?;
44
45 Ok(())
47}