Use `--manifest-path` for `Cargo.toml`, and modify `AppSettings`.

This allows the extra arguments to be forwarded through to `cargo`
without requiring `--` beforehand.
master
Azriel Hoh 5 years ago
parent 3768551558
commit b75773a2fe
  1. 8
      src/command/test.rs
  2. 9
      tests/all/test.rs

@ -12,12 +12,17 @@ use log::info;
use manifest;
use std::path::PathBuf;
use std::time::Instant;
use structopt::clap::AppSettings;
use test::{self, webdriver};
#[derive(Debug, Default, StructOpt)]
#[structopt(
setting = AppSettings::AllowLeadingHyphen,
setting = AppSettings::TrailingVarArg,
)]
/// Everything required to configure the `wasm-pack test` command.
pub struct TestOptions {
#[structopt(parse(from_os_str))]
#[structopt(parse(from_os_str), long = "manifest-path")]
/// The path to the Rust crate. If not set, searches up the path from the current dirctory.
pub path: Option<PathBuf>,
@ -74,7 +79,6 @@ pub struct TestOptions {
/// Build with the release profile.
pub release: bool,
#[structopt(last = true)]
/// List of extra options to pass to `cargo test`
pub extra_options: Vec<String>,
}

@ -391,14 +391,7 @@ fn extra_options_is_passed_to_cargo_when_building_tests() {
let _lock = fixture.lock();
fixture
.wasm_pack()
.args(&[
"test",
"--node",
"--",
"--no-default-features",
"--",
"smoke",
])
.args(&["test", "--node", "--no-default-features", "--", "smoke"])
.assert()
.success();
}

Loading…
Cancel
Save