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
pub mod webdriver;
use child;
use failure::{self, ResultExt};
use log::info;
use std::ffi::OsStr;
use std::path::Path;
use std::process::Command;
pub fn cargo_test_wasm<I, K, V>(path: &Path, release: bool, envs: I) -> Result<(), failure::Error>
where
I: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
{
let output = {
let mut cmd = Command::new("cargo");
cmd.envs(envs);
cmd.current_dir(path).arg("test");
if release {
cmd.arg("--release");
}
cmd.arg("--target").arg("wasm32-unknown-unknown");
child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")?
};
for line in output.lines() {
info!("test output: {}", line);
println!("{}", line);
}
Ok(())
}