Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bindgen version & fix some cache issue #526

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 63 additions & 70 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/all/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand All @@ -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());
Expand Down
5 changes: 2 additions & 3 deletions tests/all/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -87,7 +86,7 @@ fn renamed_crate_name_works() {
name = 'bar'

[dependencies]
wasm-bindgen = "=0.2.21"
wasm-bindgen = "0.2"
"#,
)
.file(
Expand Down
12 changes: 6 additions & 6 deletions tests/all/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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(
Expand All @@ -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]
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"),);
}
19 changes: 12 additions & 7 deletions tests/all/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -322,13 +322,18 @@ 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")
.arg("--node")
.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
}));
}
34 changes: 17 additions & 17 deletions tests/all/utils/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down Expand Up @@ -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) =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down