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

Copy port from headless test server when using WASM_BINDGEN_TEST_ADDRESS #3872

Closed
wants to merge 13 commits into from
1 change: 1 addition & 0 deletions crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,7 @@ impl<'a> Context<'a> {
self.memview("Float64", memory)
}

#[allow(dead_code)]
fn memview_function(&mut self, t: VectorKind, memory: MemoryId) -> MemView {
match t {
VectorKind::String => self.expose_uint8_memory(memory),
Expand Down
10 changes: 8 additions & 2 deletions crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error

// Visit our local server to open up the page that runs tests, and then get
// some handles to objects on the page which we'll be scraping output from.
let url =
std::env::var("WASM_BINDGEN_TEST_ADDRESS").unwrap_or_else(|_| format!("http://{}", server));
let url = match std::env::var("WASM_BINDGEN_TEST_ADDRESS") {
Ok(u) => {
let mut url = Url::parse(&u)?;
let _ = url.set_port(url.port().or(Some(server.port())));
url.as_str().to_owned()
}
Err(_) => format!("http://{}", server),
};
shell.status(&format!("Visiting {}...", url));
client.goto(&id, &url)?;
shell.status("Loading page elements...");
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/bin/wasm-bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct Args {
flag_no_modules_global: Option<String>,
flag_remove_name_section: bool,
flag_remove_producers_section: bool,
#[allow(dead_code)]
flag_weak_refs: Option<bool>,
flag_reference_types: Option<bool>,
flag_keep_lld_exports: bool,
Expand Down