Remove the no longer needed `Step` type

While historically used to count steps in stages the count is no longer
present in the output so this should no longer be necessary.
master
Alex Crichton 6 years ago
parent 7c8d1a80a8
commit b710fde193
  1. 4
      src/bindgen.rs
  2. 8
      src/build.rs
  3. 34
      src/command/build.rs
  4. 35
      src/command/test.rs
  5. 32
      src/progressbar.rs
  6. 16
      src/test/webdriver.rs
  7. 10
      tests/all/utils/fixture.rs
  8. 6
      tests/all/webdriver.rs

@ -8,7 +8,6 @@ use failure::{self, ResultExt};
use log::debug; use log::debug;
use log::{info, warn}; use log::{info, warn};
use manifest::CrateData; use manifest::CrateData;
use progressbar::Step;
use std::env; use std::env;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -27,7 +26,6 @@ pub fn install_wasm_bindgen(
cache: &Cache, cache: &Cache,
version: &str, version: &str,
install_permitted: bool, install_permitted: bool,
step: &Step,
) -> Result<Download, failure::Error> { ) -> Result<Download, failure::Error> {
// If `wasm-bindgen` is installed globally and it has the right version, use // If `wasm-bindgen` is installed globally and it has the right version, use
// that. Assume that other tools are installed next to it. // that. Assume that other tools are installed next to it.
@ -42,7 +40,7 @@ pub fn install_wasm_bindgen(
} }
let msg = format!("{}Installing wasm-bindgen...", emoji::DOWN_ARROW); let msg = format!("{}Installing wasm-bindgen...", emoji::DOWN_ARROW);
PBAR.step(step, &msg); PBAR.step(&msg);
let dl = download_prebuilt_wasm_bindgen(&cache, version, install_permitted); let dl = download_prebuilt_wasm_bindgen(&cache, version, install_permitted);
match dl { match dl {

@ -4,7 +4,6 @@ use child;
use command::build::BuildProfile; use command::build::BuildProfile;
use emoji; use emoji;
use failure::{Error, ResultExt}; use failure::{Error, ResultExt};
use progressbar::Step;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::str; use std::str;
@ -49,7 +48,7 @@ fn rustc_minor_version() -> Option<u32> {
/// Ensure that `rustup` has the `wasm32-unknown-unknown` target installed for /// Ensure that `rustup` has the `wasm32-unknown-unknown` target installed for
/// current toolchain /// current toolchain
pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> { pub fn rustup_add_wasm_target() -> Result<(), Error> {
let mut cmd = Command::new("rustc"); let mut cmd = Command::new("rustc");
cmd.arg("--print").arg("sysroot"); cmd.arg("--print").arg("sysroot");
let output = let output =
@ -64,7 +63,7 @@ pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> {
// ... otherwise fall back to rustup to add the target // ... otherwise fall back to rustup to add the target
let msg = format!("{}Adding Wasm target...", emoji::TARGET); let msg = format!("{}Adding Wasm target...", emoji::TARGET);
PBAR.step(step, &msg); PBAR.step(&msg);
let mut cmd = Command::new("rustup"); let mut cmd = Command::new("rustup");
cmd.arg("target").arg("add").arg("wasm32-unknown-unknown"); cmd.arg("target").arg("add").arg("wasm32-unknown-unknown");
child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?; child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?;
@ -75,11 +74,10 @@ pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> {
pub fn cargo_build_wasm( pub fn cargo_build_wasm(
path: &Path, path: &Path,
profile: BuildProfile, profile: BuildProfile,
step: &Step,
extra_options: &Vec<String>, extra_options: &Vec<String>,
) -> Result<(), Error> { ) -> Result<(), Error> {
let msg = format!("{}Compiling to Wasm...", emoji::CYCLONE); let msg = format!("{}Compiling to Wasm...", emoji::CYCLONE);
PBAR.step(step, &msg); PBAR.step(&msg);
let mut cmd = Command::new("cargo"); let mut cmd = Command::new("cargo");
cmd.current_dir(path).arg("build").arg("--lib"); cmd.current_dir(path).arg("build").arg("--lib");
match profile { match profile {

@ -11,7 +11,6 @@ use license;
use lockfile::Lockfile; use lockfile::Lockfile;
use log::info; use log::info;
use manifest; use manifest;
use progressbar::Step;
use readme; use readme;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
@ -183,7 +182,7 @@ impl Default for BuildOptions {
} }
} }
type BuildStep = fn(&mut Build, &Step) -> Result<(), Error>; type BuildStep = fn(&mut Build) -> Result<(), Error>;
impl Build { impl Build {
/// Construct a build command from the given options. /// Construct a build command from the given options.
@ -226,13 +225,10 @@ impl Build {
pub fn run(&mut self) -> Result<(), Error> { pub fn run(&mut self) -> Result<(), Error> {
let process_steps = Build::get_process_steps(self.mode); let process_steps = Build::get_process_steps(self.mode);
let mut step_counter = Step::new(process_steps.len());
let started = Instant::now(); let started = Instant::now();
for (_, process_step) in process_steps { for (_, process_step) in process_steps {
process_step(self, &step_counter)?; process_step(self)?;
step_counter.inc();
} }
let duration = crate::command::utils::elapsed(started.elapsed()); let duration = crate::command::utils::elapsed(started.elapsed());
@ -297,7 +293,7 @@ impl Build {
} }
} }
fn step_check_rustc_version(&mut self, _step: &Step) -> Result<(), Error> { fn step_check_rustc_version(&mut self) -> Result<(), Error> {
info!("Checking rustc version..."); info!("Checking rustc version...");
let version = build::check_rustc_version()?; let version = build::check_rustc_version()?;
let msg = format!("rustc version is {}.", version); let msg = format!("rustc version is {}.", version);
@ -305,23 +301,23 @@ impl Build {
Ok(()) Ok(())
} }
fn step_check_crate_config(&mut self, _step: &Step) -> Result<(), Error> { fn step_check_crate_config(&mut self) -> Result<(), Error> {
info!("Checking crate configuration..."); info!("Checking crate configuration...");
self.crate_data.check_crate_config()?; self.crate_data.check_crate_config()?;
info!("Crate is correctly configured."); info!("Crate is correctly configured.");
Ok(()) Ok(())
} }
fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), Error> { fn step_add_wasm_target(&mut self) -> Result<(), Error> {
info!("Adding wasm-target..."); info!("Adding wasm-target...");
build::rustup_add_wasm_target(step)?; build::rustup_add_wasm_target()?;
info!("Adding wasm-target was successful."); info!("Adding wasm-target was successful.");
Ok(()) Ok(())
} }
fn step_build_wasm(&mut self, step: &Step) -> Result<(), Error> { fn step_build_wasm(&mut self) -> Result<(), Error> {
info!("Building wasm..."); info!("Building wasm...");
build::cargo_build_wasm(&self.crate_path, self.profile, step, &self.extra_options)?; build::cargo_build_wasm(&self.crate_path, self.profile, &self.extra_options)?;
info!( info!(
"wasm built at {:#?}.", "wasm built at {:#?}.",
@ -334,14 +330,14 @@ impl Build {
Ok(()) Ok(())
} }
fn step_create_dir(&mut self, _step: &Step) -> Result<(), Error> { fn step_create_dir(&mut self) -> Result<(), Error> {
info!("Creating a pkg directory..."); info!("Creating a pkg directory...");
create_pkg_dir(&self.out_dir)?; create_pkg_dir(&self.out_dir)?;
info!("Created a pkg directory at {:#?}.", &self.crate_path); info!("Created a pkg directory at {:#?}.", &self.crate_path);
Ok(()) Ok(())
} }
fn step_create_json(&mut self, _step: &Step) -> Result<(), Error> { fn step_create_json(&mut self) -> Result<(), Error> {
self.crate_data.write_package_json( self.crate_data.write_package_json(
&self.out_dir, &self.out_dir,
&self.scope, &self.scope,
@ -355,21 +351,21 @@ impl Build {
Ok(()) Ok(())
} }
fn step_copy_readme(&mut self, _step: &Step) -> Result<(), Error> { fn step_copy_readme(&mut self) -> Result<(), Error> {
info!("Copying readme from crate..."); info!("Copying readme from crate...");
readme::copy_from_crate(&self.crate_path, &self.out_dir)?; readme::copy_from_crate(&self.crate_path, &self.out_dir)?;
info!("Copied readme from crate to {:#?}.", &self.out_dir); info!("Copied readme from crate to {:#?}.", &self.out_dir);
Ok(()) Ok(())
} }
fn step_copy_license(&mut self, _step: &Step) -> Result<(), failure::Error> { fn step_copy_license(&mut self) -> Result<(), failure::Error> {
info!("Copying license from crate..."); info!("Copying license from crate...");
license::copy_from_crate(&self.crate_data, &self.crate_path, &self.out_dir)?; license::copy_from_crate(&self.crate_data, &self.crate_path, &self.out_dir)?;
info!("Copied license from crate to {:#?}.", &self.out_dir); info!("Copied license from crate to {:#?}.", &self.out_dir);
Ok(()) Ok(())
} }
fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), failure::Error> { fn step_install_wasm_bindgen(&mut self) -> Result<(), failure::Error> {
info!("Identifying wasm-bindgen dependency..."); info!("Identifying wasm-bindgen dependency...");
let lockfile = Lockfile::new(&self.crate_data)?; let lockfile = Lockfile::new(&self.crate_data)?;
let bindgen_version = lockfile.require_wasm_bindgen()?; let bindgen_version = lockfile.require_wasm_bindgen()?;
@ -380,13 +376,13 @@ impl Build {
BuildMode::Noinstall => false, BuildMode::Noinstall => false,
}; };
let bindgen = let bindgen =
bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted, step)?; bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted)?;
self.bindgen = Some(bindgen); self.bindgen = Some(bindgen);
info!("Installing wasm-bindgen-cli was successful."); info!("Installing wasm-bindgen-cli was successful.");
Ok(()) Ok(())
} }
fn step_run_wasm_bindgen(&mut self, _step: &Step) -> Result<(), Error> { fn step_run_wasm_bindgen(&mut self) -> Result<(), Error> {
info!("Building the wasm bindings..."); info!("Building the wasm bindings...");
bindgen::wasm_bindgen_build( bindgen::wasm_bindgen_build(
&self.crate_data, &self.crate_data,

@ -11,7 +11,6 @@ use failure::Error;
use lockfile::Lockfile; use lockfile::Lockfile;
use log::info; use log::info;
use manifest; use manifest;
use progressbar::Step;
use std::path::PathBuf; use std::path::PathBuf;
use std::time::Instant; use std::time::Instant;
use test::{self, webdriver}; use test::{self, webdriver};
@ -100,7 +99,7 @@ pub struct Test {
extra_options: Vec<String>, extra_options: Vec<String>,
} }
type TestStep = fn(&mut Test, &Step) -> Result<(), Error>; type TestStep = fn(&mut Test) -> Result<(), Error>;
impl Test { impl Test {
/// Construct a test command from the given options. /// Construct a test command from the given options.
@ -162,12 +161,10 @@ impl Test {
/// Execute this test command. /// Execute this test command.
pub fn run(mut self) -> Result<(), Error> { pub fn run(mut self) -> Result<(), Error> {
let process_steps = self.get_process_steps(); let process_steps = self.get_process_steps();
let mut step_counter = Step::new(process_steps.len());
let started = Instant::now(); let started = Instant::now();
for (_, process_step) in process_steps { for (_, process_step) in process_steps {
process_step(&mut self, &step_counter)?; process_step(&mut self)?;
step_counter.inc();
} }
let duration = crate::command::utils::elapsed(started.elapsed()); let duration = crate::command::utils::elapsed(started.elapsed());
info!("Done in {}.", &duration); info!("Done in {}.", &duration);
@ -230,21 +227,21 @@ impl Test {
} }
} }
fn step_check_rustc_version(&mut self, _step: &Step) -> Result<(), Error> { fn step_check_rustc_version(&mut self) -> Result<(), Error> {
info!("Checking rustc version..."); info!("Checking rustc version...");
let _ = build::check_rustc_version()?; let _ = build::check_rustc_version()?;
info!("Rustc version is correct."); info!("Rustc version is correct.");
Ok(()) Ok(())
} }
fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), Error> { fn step_add_wasm_target(&mut self) -> Result<(), Error> {
info!("Adding wasm-target..."); info!("Adding wasm-target...");
build::rustup_add_wasm_target(step)?; build::rustup_add_wasm_target()?;
info!("Adding wasm-target was successful."); info!("Adding wasm-target was successful.");
Ok(()) Ok(())
} }
fn step_build_tests(&mut self, _step: &Step) -> Result<(), Error> { fn step_build_tests(&mut self) -> Result<(), Error> {
info!("Compiling tests to wasm..."); info!("Compiling tests to wasm...");
build::cargo_build_wasm_tests(&self.crate_path, !self.release)?; build::cargo_build_wasm_tests(&self.crate_path, !self.release)?;
@ -253,7 +250,7 @@ impl Test {
Ok(()) Ok(())
} }
fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), Error> { fn step_install_wasm_bindgen(&mut self) -> Result<(), Error> {
info!("Identifying wasm-bindgen dependency..."); info!("Identifying wasm-bindgen dependency...");
let lockfile = Lockfile::new(&self.crate_data)?; let lockfile = Lockfile::new(&self.crate_data)?;
let bindgen_version = lockfile.require_wasm_bindgen()?; let bindgen_version = lockfile.require_wasm_bindgen()?;
@ -288,7 +285,7 @@ impl Test {
}; };
let dl = let dl =
bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted, step)?; bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted)?;
self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")?); self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")?);
@ -296,7 +293,7 @@ impl Test {
Ok(()) Ok(())
} }
fn step_test_node(&mut self, _step: &Step) -> Result<(), Error> { fn step_test_node(&mut self) -> Result<(), Error> {
assert!(self.node); assert!(self.node);
info!("Running tests in node..."); info!("Running tests in node...");
test::cargo_test_wasm( test::cargo_test_wasm(
@ -312,18 +309,17 @@ impl Test {
Ok(()) Ok(())
} }
fn step_get_chromedriver(&mut self, step: &Step) -> Result<(), Error> { fn step_get_chromedriver(&mut self) -> Result<(), Error> {
assert!(self.chrome && self.chromedriver.is_none()); assert!(self.chrome && self.chromedriver.is_none());
self.chromedriver = Some(webdriver::get_or_install_chromedriver( self.chromedriver = Some(webdriver::get_or_install_chromedriver(
&self.cache, &self.cache,
self.mode, self.mode,
step,
)?); )?);
Ok(()) Ok(())
} }
fn step_test_chrome(&mut self, _step: &Step) -> Result<(), Error> { fn step_test_chrome(&mut self) -> Result<(), Error> {
let chromedriver = self.chromedriver.as_ref().unwrap().display().to_string(); let chromedriver = self.chromedriver.as_ref().unwrap().display().to_string();
let chromedriver = chromedriver.as_str(); let chromedriver = chromedriver.as_str();
info!( info!(
@ -352,18 +348,17 @@ impl Test {
Ok(()) Ok(())
} }
fn step_get_geckodriver(&mut self, step: &Step) -> Result<(), Error> { fn step_get_geckodriver(&mut self) -> Result<(), Error> {
assert!(self.firefox && self.geckodriver.is_none()); assert!(self.firefox && self.geckodriver.is_none());
self.geckodriver = Some(webdriver::get_or_install_geckodriver( self.geckodriver = Some(webdriver::get_or_install_geckodriver(
&self.cache, &self.cache,
self.mode, self.mode,
step,
)?); )?);
Ok(()) Ok(())
} }
fn step_test_firefox(&mut self, _step: &Step) -> Result<(), Error> { fn step_test_firefox(&mut self) -> Result<(), Error> {
let geckodriver = self.geckodriver.as_ref().unwrap().display().to_string(); let geckodriver = self.geckodriver.as_ref().unwrap().display().to_string();
let geckodriver = geckodriver.as_str(); let geckodriver = geckodriver.as_str();
info!( info!(
@ -392,14 +387,14 @@ impl Test {
Ok(()) Ok(())
} }
fn step_get_safaridriver(&mut self, _step: &Step) -> Result<(), Error> { fn step_get_safaridriver(&mut self) -> Result<(), Error> {
assert!(self.safari && self.safaridriver.is_none()); assert!(self.safari && self.safaridriver.is_none());
self.safaridriver = Some(webdriver::get_safaridriver()?); self.safaridriver = Some(webdriver::get_safaridriver()?);
Ok(()) Ok(())
} }
fn step_test_safari(&mut self, _step: &Step) -> Result<(), Error> { fn step_test_safari(&mut self) -> Result<(), Error> {
let safaridriver = self.safaridriver.as_ref().unwrap().display().to_string(); let safaridriver = self.safaridriver.as_ref().unwrap().display().to_string();
let safaridriver = safaridriver.as_str(); let safaridriver = safaridriver.as_str();
info!( info!(

@ -2,7 +2,6 @@
use console::style; use console::style;
use emoji; use emoji;
use std::fmt;
/// Synchronized progress bar and status message printing. /// Synchronized progress bar and status message printing.
pub struct ProgressOutput; pub struct ProgressOutput;
@ -10,8 +9,8 @@ pub struct ProgressOutput;
impl ProgressOutput { impl ProgressOutput {
/// Inform the user that the given `step` is being executed, with details in /// Inform the user that the given `step` is being executed, with details in
/// `message`. /// `message`.
pub fn step(&self, step: &Step, message: &str) { pub fn step(&self, message: &str) {
let msg = format!("{} {}", style(step).bold().dim(), message); let msg = format!("{} {}", style(emoji::INFO).bold().dim(), message);
self.message(&msg) self.message(&msg)
} }
@ -58,33 +57,6 @@ impl ProgressOutput {
} }
} }
/// For processes that can be broken down into N fractional steps, with messages
/// added for each step along the way like
///
/// > [2/5] Doing the second step out of five.
pub struct Step {
current: usize,
total: usize,
}
impl Step {
/// Construct a `Step` where there are `total` number of steps.
pub fn new(total: usize) -> Step {
Step { current: 1, total }
}
/// Increment the current step.
pub fn inc(&mut self) {
self.current += 1;
}
}
impl fmt::Display for Step {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", emoji::INFO)
}
}
impl Default for ProgressOutput { impl Default for ProgressOutput {
fn default() -> Self { fn default() -> Self {
ProgressOutput ProgressOutput

@ -1,6 +1,5 @@
//! Getting WebDriver client binaries. //! Getting WebDriver client binaries.
use crate::progressbar::Step;
use binary_install::Cache; use binary_install::Cache;
use command::build::BuildMode; use command::build::BuildMode;
use failure; use failure;
@ -13,13 +12,12 @@ fn get_and_notify(
installation_allowed: bool, installation_allowed: bool,
name: &str, name: &str,
url: &str, url: &str,
step: &Step,
) -> Result<Option<PathBuf>, failure::Error> { ) -> Result<Option<PathBuf>, failure::Error> {
if let Some(dl) = cache.download(false, name, &[name], &url)? { if let Some(dl) = cache.download(false, name, &[name], &url)? {
return Ok(Some(dl.binary(name)?)); return Ok(Some(dl.binary(name)?));
} }
if installation_allowed { if installation_allowed {
PBAR.step(step, &format!("Getting {}...", name)); PBAR.step(&format!("Getting {}...", name));
} }
match cache.download(installation_allowed, name, &[name], &url)? { match cache.download(installation_allowed, name, &[name], &url)? {
Some(dl) => Ok(Some(dl.binary(name)?)), Some(dl) => Ok(Some(dl.binary(name)?)),
@ -32,7 +30,6 @@ fn get_and_notify(
pub fn get_or_install_chromedriver( pub fn get_or_install_chromedriver(
cache: &Cache, cache: &Cache,
mode: BuildMode, mode: BuildMode,
step: &Step,
) -> Result<PathBuf, failure::Error> { ) -> Result<PathBuf, failure::Error> {
if let Ok(path) = which::which("chromedriver") { if let Ok(path) = which::which("chromedriver") {
return Ok(path); return Ok(path);
@ -41,14 +38,13 @@ pub fn get_or_install_chromedriver(
BuildMode::Noinstall => false, BuildMode::Noinstall => false,
_ => true, _ => true,
}; };
install_chromedriver(cache, installation_allowed, step) install_chromedriver(cache, installation_allowed)
} }
/// Download and install a pre-built `chromedriver` binary. /// Download and install a pre-built `chromedriver` binary.
pub fn install_chromedriver( pub fn install_chromedriver(
cache: &Cache, cache: &Cache,
installation_allowed: bool, installation_allowed: bool,
step: &Step,
) -> Result<PathBuf, failure::Error> { ) -> Result<PathBuf, failure::Error> {
let target = if target::LINUX && target::x86_64 { let target = if target::LINUX && target::x86_64 {
"linux64" "linux64"
@ -64,7 +60,7 @@ pub fn install_chromedriver(
"https://chromedriver.storage.googleapis.com/2.46/chromedriver_{}.zip", "https://chromedriver.storage.googleapis.com/2.46/chromedriver_{}.zip",
target target
); );
match get_and_notify(cache, installation_allowed, "chromedriver", &url, step)? { match get_and_notify(cache, installation_allowed, "chromedriver", &url)? {
Some(path) => Ok(path), Some(path) => Ok(path),
None => bail!( None => bail!(
"No cached `chromedriver` binary found, and could not find a global \ "No cached `chromedriver` binary found, and could not find a global \
@ -79,7 +75,6 @@ pub fn install_chromedriver(
pub fn get_or_install_geckodriver( pub fn get_or_install_geckodriver(
cache: &Cache, cache: &Cache,
mode: BuildMode, mode: BuildMode,
step: &Step,
) -> Result<PathBuf, failure::Error> { ) -> Result<PathBuf, failure::Error> {
if let Ok(path) = which::which("geckodriver") { if let Ok(path) = which::which("geckodriver") {
return Ok(path); return Ok(path);
@ -88,14 +83,13 @@ pub fn get_or_install_geckodriver(
BuildMode::Noinstall => false, BuildMode::Noinstall => false,
_ => true, _ => true,
}; };
install_geckodriver(cache, installation_allowed, step) install_geckodriver(cache, installation_allowed)
} }
/// Download and install a pre-built `geckodriver` binary. /// Download and install a pre-built `geckodriver` binary.
pub fn install_geckodriver( pub fn install_geckodriver(
cache: &Cache, cache: &Cache,
installation_allowed: bool, installation_allowed: bool,
step: &Step,
) -> Result<PathBuf, failure::Error> { ) -> Result<PathBuf, failure::Error> {
let (target, ext) = if target::LINUX && target::x86 { let (target, ext) = if target::LINUX && target::x86 {
("linux32", "tar.gz") ("linux32", "tar.gz")
@ -116,7 +110,7 @@ pub fn install_geckodriver(
target, target,
ext, ext,
); );
match get_and_notify(cache, installation_allowed, "geckodriver", &url, step)? { match get_and_notify(cache, installation_allowed, "geckodriver", &url)? {
Some(path) => Ok(path), Some(path) => Ok(path),
None => bail!( None => bail!(
"No cached `geckodriver` binary found, and could not find a global `geckodriver` \ "No cached `geckodriver` binary found, and could not find a global `geckodriver` \

@ -245,11 +245,10 @@ impl Fixture {
let cache = self.cache(); let cache = self.cache();
// like above for synchronization // like above for synchronization
let step = wasm_pack::progressbar::Step::new(1);
FETCH_GECKODRIVER.call_once(|| { FETCH_GECKODRIVER.call_once(|| {
wasm_pack::test::webdriver::install_geckodriver(&cache, true, &step).unwrap(); wasm_pack::test::webdriver::install_geckodriver(&cache, true).unwrap();
}); });
wasm_pack::test::webdriver::install_geckodriver(&cache, true, &step).unwrap() wasm_pack::test::webdriver::install_geckodriver(&cache, true).unwrap()
} }
/// Download `chromedriver` and return its path. /// Download `chromedriver` and return its path.
@ -261,11 +260,10 @@ impl Fixture {
let cache = self.cache(); let cache = self.cache();
// like above for synchronization // like above for synchronization
let step = wasm_pack::progressbar::Step::new(1);
FETCH_CHROMEDRIVER.call_once(|| { FETCH_CHROMEDRIVER.call_once(|| {
wasm_pack::test::webdriver::install_chromedriver(&cache, true, &step).unwrap(); wasm_pack::test::webdriver::install_chromedriver(&cache, true).unwrap();
}); });
wasm_pack::test::webdriver::install_chromedriver(&cache, true, &step).unwrap() wasm_pack::test::webdriver::install_chromedriver(&cache, true).unwrap()
} }
pub fn cache_dir(&self) -> PathBuf { pub fn cache_dir(&self) -> PathBuf {

@ -12,8 +12,7 @@ use wasm_pack::test::webdriver;
fn can_install_chromedriver() { fn can_install_chromedriver() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let cache = Cache::at(&fixture.path); let cache = Cache::at(&fixture.path);
let step = wasm_pack::progressbar::Step::new(1); assert!(webdriver::install_chromedriver(&cache, true).is_ok());
assert!(webdriver::install_chromedriver(&cache, true, &step).is_ok());
} }
#[test] #[test]
@ -27,6 +26,5 @@ fn can_install_chromedriver() {
fn can_install_geckodriver() { fn can_install_geckodriver() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let cache = Cache::at(&fixture.path); let cache = Cache::at(&fixture.path);
let step = wasm_pack::progressbar::Step::new(1); assert!(webdriver::install_geckodriver(&cache, true).is_ok());
assert!(webdriver::install_geckodriver(&cache, true, &step).is_ok());
} }

Loading…
Cancel
Save