From 292916db91aed4638ac6d7920f6b39ed74cb49f3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Dec 2024 22:09:37 +0100 Subject: [PATCH] Error if URL in `_REMOTE` can't be parsed (#4362) --- CHANGELOG.md | 6 ++++++ crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722a63dd7f7..b818523fd2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Align test output closer to native `cargo test`. [#4358](https://github.com/rustwasm/wasm-bindgen/pull/4358) +* Error if URL in `_REMOTE` can't be parsed instead of just ignoring it. + [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. @@ -49,6 +52,9 @@ * Use OS provided temporary directory for tests instead of Cargo's `target` directory. [#4361](https://github.com/rustwasm/wasm-bindgen/pull/4361) +* Error if URL in `_REMOTE` can't be parsed. + [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 9692f83fce3..6064475312d 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -269,10 +269,7 @@ impl Driver { for (driver, ctor) in drivers.iter() { let env = format!("{}_REMOTE", driver.to_uppercase()); let url = match env::var(&env) { - Ok(var) => match Url::parse(&var) { - Ok(url) => url, - Err(_) => continue, - }, + Ok(var) => Url::parse(&var).context(format!("failed to parse `{env}`"))?, Err(_) => continue, }; return Ok(ctor(Locate::Remote(url)));