diff --git a/tests/all/license.rs b/tests/all/license.rs index 75dcd5c..f56f650 100644 --- a/tests/all/license.rs +++ b/tests/all/license.rs @@ -14,8 +14,7 @@ fn it_copies_a_license_default_path() { fs::create_dir(&out_dir).expect("should create pkg directory OK"); let crate_data = CrateData::new(&fixture.path); - let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); let crate_license_path = fixture.path.join("LICENSE"); let pkg_license_path = out_dir.join("LICENSE"); @@ -40,8 +39,7 @@ fn it_copies_a_license_provided_path() { fs::create_dir(&out_dir).expect("should create pkg directory OK"); let crate_data = CrateData::new(&fixture.path); - let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); let crate_license_path = fixture.path.join("LICENSE"); let pkg_license_path = out_dir.join("LICENSE"); println!( @@ -64,8 +62,7 @@ fn it_copies_all_licenses_default_path() { fs::create_dir(&out_dir).expect("should create pkg directory OK"); let crate_data = CrateData::new(&fixture.path); - let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); @@ -100,8 +97,7 @@ fn it_copies_all_licenses_provided_path() { fs::create_dir(&out_dir).expect("should create pkg directory OK"); let crate_data = CrateData::new(&fixture.path); - let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); @@ -137,8 +133,7 @@ fn it_copies_a_non_standard_license_provided_path() { fs::create_dir(&out_dir).expect("should create pkg directory OK"); let crate_data = CrateData::new(&fixture.path); - let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); let crate_license_path = fixture.path.join(license_file); let pkg_license_path = out_dir.join(license_file); diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 6c274d2..0298ed5 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -27,8 +27,7 @@ fn it_checks_has_cdylib_default_path() { // Ensure that there is a `Cargo.lock`. fixture.cargo_check(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - assert!(crate_data.check_crate_config(&step).is_err()); + assert!(crate_data.check_crate_config().is_err()); } #[test] @@ -37,16 +36,14 @@ fn it_checks_has_cdylib_provided_path() { // Ensure that there is a `Cargo.lock`. fixture.cargo_check(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - crate_data.check_crate_config(&step).unwrap(); + crate_data.check_crate_config().unwrap(); } #[test] fn it_checks_has_cdylib_wrong_crate_type() { let fixture = fixture::bad_cargo_toml(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - assert!(crate_data.check_crate_config(&step).is_err()); + assert!(crate_data.check_crate_config().is_err()); } #[test] @@ -55,8 +52,7 @@ fn it_recognizes_a_map_during_depcheck() { // Ensure that there is a `Cargo.lock`. fixture.cargo_check(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - crate_data.check_crate_config(&step).unwrap(); + crate_data.check_crate_config().unwrap(); } #[test] @@ -64,10 +60,9 @@ fn it_creates_a_package_json_default_path() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, false, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, false, &Target::Bundler) .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -100,10 +95,9 @@ fn it_creates_a_package_json_provided_path() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, false, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, false, &Target::Bundler) .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -129,15 +123,13 @@ fn it_creates_a_package_json_provided_path_with_scope() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data .write_package_json( &out_dir, &Some("test".to_string()), false, &Target::Bundler, - &step ) .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); @@ -164,10 +156,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, false, &Target::Nodejs, &step) + .write_package_json(&out_dir, &None, false, &Target::Nodejs) .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -200,10 +191,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, false, &Target::NoModules, &step) + .write_package_json(&out_dir, &None, false, &Target::NoModules) .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -235,10 +225,9 @@ fn it_creates_a_pkg_json_in_out_dir() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("./custom/out"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, false, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, false, &Target::Bundler) .is_ok()); let package_json_path = &fixture.path.join(&out_dir).join("package.json"); @@ -251,10 +240,9 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { let fixture = fixture::js_hello_world(); let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); assert!(crate_data - .write_package_json(&out_dir, &None, true, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, true, &Target::Bundler) .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -280,8 +268,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { fn it_errors_when_wasm_bindgen_is_not_declared() { let fixture = fixture::bad_cargo_toml(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - assert!(crate_data.check_crate_config(&step).is_err()); + assert!(crate_data.check_crate_config().is_err()); } #[test] @@ -314,10 +301,9 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() { let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(2); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); crate_data - .write_package_json(&out_dir, &None, true, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, true, &Target::Bundler) .unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -331,10 +317,9 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() { let out_dir = fixture.path.join("pkg"); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(2); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); crate_data - .write_package_json(&out_dir, &None, true, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, true, &Target::Bundler) .unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -347,8 +332,7 @@ fn it_does_not_error_when_wasm_bindgen_is_declared() { // Ensure that there is a `Cargo.lock`. fixture.cargo_check(); let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(1); - crate_data.check_crate_config(&step).unwrap(); + crate_data.check_crate_config().unwrap(); } #[test] @@ -433,11 +417,10 @@ fn it_lists_license_files_in_files_field_of_package_json() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); - let step = wasm_pack::progressbar::Step::new(3); - wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - license::copy_from_crate(&crate_data, &fixture.path, &out_dir, &step).unwrap(); + wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); + license::copy_from_crate(&crate_data, &fixture.path, &out_dir).unwrap(); crate_data - .write_package_json(&out_dir, &None, false, &Target::Bundler, &step) + .write_package_json(&out_dir, &None, false, &Target::Bundler) .unwrap(); let package_json_path = &fixture.path.join("pkg").join("package.json"); diff --git a/tests/all/readme.rs b/tests/all/readme.rs index af2fbcd..8576f33 100644 --- a/tests/all/readme.rs +++ b/tests/all/readme.rs @@ -12,8 +12,7 @@ fn it_copies_a_readme_default_path() { let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); - let step = wasm_pack::progressbar::Step::new(1); - assert!(readme::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(readme::copy_from_crate(&fixture.path, &out_dir).is_ok()); let crate_readme_path = fixture.path.join("README.md"); let pkg_readme_path = out_dir.join("README.md"); @@ -37,8 +36,7 @@ fn it_copies_a_readme_provided_path() { let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); - let step = wasm_pack::progressbar::Step::new(1); - assert!(readme::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(readme::copy_from_crate(&fixture.path, &out_dir).is_ok()); let crate_readme_path = fixture.path.join("README.md"); let pkg_readme_path = out_dir.join("README.md"); println!( diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index fced91c..11c323e 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -245,10 +245,11 @@ impl Fixture { let cache = self.cache(); // like above for synchronization + let step = wasm_pack::progressbar::Step::new(1); FETCH_GECKODRIVER.call_once(|| { - 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() + wasm_pack::test::webdriver::install_geckodriver(&cache, true, &step).unwrap() } /// Download `chromedriver` and return its path. @@ -260,10 +261,11 @@ impl Fixture { let cache = self.cache(); // like above for synchronization + let step = wasm_pack::progressbar::Step::new(1); FETCH_CHROMEDRIVER.call_once(|| { - 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() + wasm_pack::test::webdriver::install_chromedriver(&cache, true, &step).unwrap() } pub fn cache_dir(&self) -> PathBuf { diff --git a/tests/all/webdriver.rs b/tests/all/webdriver.rs index 6223290..15f84e3 100644 --- a/tests/all/webdriver.rs +++ b/tests/all/webdriver.rs @@ -12,7 +12,8 @@ use wasm_pack::test::webdriver; fn can_install_chromedriver() { let fixture = fixture::js_hello_world(); let cache = Cache::at(&fixture.path); - assert!(webdriver::install_chromedriver(&cache, true).is_ok()); + let step = wasm_pack::progressbar::Step::new(1); + assert!(webdriver::install_chromedriver(&cache, true, &step).is_ok()); } #[test] @@ -26,5 +27,6 @@ fn can_install_chromedriver() { fn can_install_geckodriver() { let fixture = fixture::js_hello_world(); let cache = Cache::at(&fixture.path); - assert!(webdriver::install_geckodriver(&cache, true).is_ok()); + let step = wasm_pack::progressbar::Step::new(1); + assert!(webdriver::install_geckodriver(&cache, true, &step).is_ok()); }