Don't pass through test filter to `cargo build`.

master
Azriel Hoh 5 years ago
parent 44e826e820
commit d1cd431a51
  1. 10
      src/command/test.rs
  2. 14
      tests/all/test.rs

@ -243,7 +243,15 @@ impl Test {
fn step_build_tests(&mut self) -> Result<(), Error> {
info!("Compiling tests to wasm...");
build::cargo_build_wasm_tests(&self.crate_path, !self.release, &self.extra_options)?;
// If the user has run `wasm-pack test -- --features "f1" -- test_name`, then we want to only pass through
// `--features "f1"` to `cargo build`
let extra_options =
if let Some(index) = self.extra_options.iter().position(|arg| arg == "--") {
&self.extra_options[..index]
} else {
&self.extra_options
};
build::cargo_build_wasm_tests(&self.crate_path, !self.release, extra_options)?;
info!("Finished compiling tests to wasm.");
Ok(())

@ -380,13 +380,25 @@ fn extra_options_is_passed_to_cargo_when_building_tests() {
fn smoke() {
foo::foo();
}
#[wasm_bindgen_test]
fn fire() {
panic!("This should be filtered from test execution.");
}
"#,
)
.install_local_wasm_bindgen();
let _lock = fixture.lock();
fixture
.wasm_pack()
.args(&["test", "--node", "--", "--no-default-features"])
.args(&[
"test",
"--node",
"--",
"--no-default-features",
"--",
"smoke",
])
.assert()
.success();
}

Loading…
Cancel
Save