Skip to content

Commit

Permalink
Support no-capture behavior in wasm-bindgen-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekleog committed Jan 20, 2024
1 parent 64e4a25 commit d9f90d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error
shell.status("Waiting for test to finish...");
let start = Instant::now();
let max = Duration::new(timeout, 0);
let mut last_logs = String::new();
while start.elapsed() < max {
if client.text(&id, &output)?.contains("test result: ") {
break;
}
let all_logs = client.text(&id, &logs)?;
let new_logs = all_logs.strip_prefix(&last_logs).expect("console.log div reduced in size");
print!("{new_logs}");
last_logs = all_logs;
thread::sleep(Duration::from_millis(100));
}
shell.clear();
Expand Down

0 comments on commit d9f90d1

Please sign in to comment.