fix(test): update wasm-bindgen versions to improving caching in tests

master
huangjj27 6 years ago committed by Ashley Williams
parent 173a05bd82
commit 0a9f488a0d
  1. 468
      Cargo.lock
  2. 4
      tests/all/bindgen.rs
  3. 5
      tests/all/build.rs
  4. 12
      tests/all/lockfile.rs
  5. 19
      tests/all/test.rs
  6. 34
      tests/all/utils/fixture.rs

468
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@ use wasm_pack::bindgen;
fn can_download_prebuilt_wasm_bindgen() {
let dir = tempfile::TempDir::new().unwrap();
let cache = Cache::at(dir.path());
let dl = bindgen::download_prebuilt_wasm_bindgen(&cache, "0.2.21", true).unwrap();
let dl = bindgen::download_prebuilt_wasm_bindgen(&cache, "0.2.37", true).unwrap();
assert!(dl.binary("wasm-bindgen").unwrap().is_file());
assert!(dl.binary("wasm-bindgen-test-runner").unwrap().is_file())
}
@ -24,7 +24,7 @@ fn can_download_prebuilt_wasm_bindgen() {
))]
fn downloading_prebuilt_wasm_bindgen_handles_http_errors() {
let dir = tempfile::TempDir::new().unwrap();
let bad_version = "0.2.21-some-trailing-version-stuff-that-does-not-exist";
let bad_version = "0.2.37-some-trailing-version-stuff-that-does-not-exist";
let cache = Cache::at(dir.path());
let result = bindgen::download_prebuilt_wasm_bindgen(&cache, bad_version, true);
assert!(result.is_err());

@ -17,7 +17,6 @@ fn build_in_non_crate_directory_doesnt_panic() {
#[test]
fn it_should_build_js_hello_world_example() {
let fixture = utils::fixture::js_hello_world();
fixture.install_local_wasm_bindgen();
fixture.wasm_pack().arg("build").assert().success();
}
@ -47,7 +46,7 @@ fn it_should_build_crates_in_a_workspace() {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
"#,
)
.file(
@ -87,7 +86,7 @@ fn renamed_crate_name_works() {
name = 'bar'
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
"#,
)
.file(

@ -8,7 +8,7 @@ fn it_gets_wasm_bindgen_version() {
fixture.cargo_check();
let data = CrateData::new(&fixture.path).unwrap();
let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.21"),);
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
}
#[test]
@ -17,7 +17,7 @@ fn it_gets_wasm_bindgen_test_version() {
fixture.cargo_check();
let data = CrateData::new(&fixture.path).unwrap();
let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_test_version(), Some("0.2.21"),);
assert_eq!(lock.wasm_bindgen_test_version(), Some("0.2.37"),);
}
#[test]
@ -46,7 +46,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "=0.2.37"
"#,
)
.file(
@ -62,7 +62,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
fixture.cargo_check();
let data = CrateData::new(&fixture.path.join("blah")).unwrap();
let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.21"),);
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
}
#[test]
@ -91,7 +91,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "=0.2.37"
"#,
)
.file(
@ -130,5 +130,5 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
fixture.cargo_check();
let data = CrateData::new(&fixture.path.join("parent")).unwrap();
let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.21"),);
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
}

@ -178,7 +178,7 @@ fn complains_about_missing_wasm_bindgen_test_dependency() {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
# no wasm-bindgen-test dep here!
@ -218,10 +218,10 @@ fn renamed_crate_name_works() {
name = 'bar'
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
)
.file(
@ -258,10 +258,10 @@ fn cdylib_not_required() {
authors = []
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
)
.file(
@ -293,7 +293,7 @@ fn cdylib_not_required() {
}
#[test]
fn test_output_is_printed_once() {
fn test_output_is_printed_once_in_both_stdout_and_failures() {
let fixture = fixture::Fixture::new();
fixture
.readme()
@ -322,6 +322,9 @@ fn test_output_is_printed_once() {
)
.install_local_wasm_bindgen();
let _lock = fixture.lock();
// there will be only one log in stdout, and only one log in failures
let log_cnt = 1;
fixture
.wasm_pack()
.arg("test")
@ -329,6 +332,8 @@ fn test_output_is_printed_once() {
.assert()
.failure()
.stderr(predicate::function(|err: &str| {
err.matches("YABBA DABBA DOO").count() == 1
// but the err string will capture both stdout and failures,
// so we will get a log that count twice
err.matches("YABBA DABBA DOO").count() == log_cnt * 2
}));
}

@ -127,10 +127,10 @@ impl Fixture {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
name
),
@ -201,7 +201,7 @@ impl Fixture {
pub fn install_local_wasm_bindgen(&self) -> PathBuf {
static INSTALL_WASM_BINDGEN: Once = ONCE_INIT;
let cache = self.cache();
let version = "0.2.21";
let version = "0.2.37";
let download = || {
if let Ok(download) =
@ -351,10 +351,10 @@ pub fn no_cdylib() -> Fixture {
# crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
);
fixture
@ -403,14 +403,14 @@ pub fn wbg_test_diff_versions() -> Fixture {
crate-type = ["cdylib", "rlib"]
[dependencies]
# We depend on wasm-bindgen 0.2.21
wasm-bindgen = "=0.2.21"
# We depend on the latest wasm-bindgen 0.2
wasm-bindgen = "0.2"
[dev-dependencies]
# And we depend on wasm-bindgen-test 0.2.19. This should still
# work, and we should end up with `wasm-bindgen` at 0.2.21 and
# wasm-bindgen-test at 0.2.19, and everything should still work.
wasm-bindgen-test = "0.2.19"
# And we depend on wasm-bindgen-test 0.2.29. This should still
# work, and we should end up with the latest `wasm-bindgen` and
# wasm-bindgen-test at 0.2.29, and everything should still work.
wasm-bindgen-test = "0.2.29"
"#,
)
.file(
@ -522,12 +522,12 @@ pub fn transitive_dependencies() -> Fixture {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
project_a = { path = "../project_a" }
project_b = { path = "../project_b" }
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
);
fixture.file(
@ -572,11 +572,11 @@ pub fn transitive_dependencies() -> Fixture {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
project_b = { path = "../project_b" }
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
);
fixture.file(
@ -622,10 +622,10 @@ pub fn transitive_dependencies() -> Fixture {
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
[dev-dependencies]
wasm-bindgen-test = "=0.2.21"
wasm-bindgen-test = "0.2"
"#,
);
fixture.file(

Loading…
Cancel
Save