diff options
| author | Bert Belder <bertbelder@gmail.com> | 2020-05-06 03:50:55 +0200 |
|---|---|---|
| committer | Bert Belder <bertbelder@gmail.com> | 2020-05-06 04:32:14 +0200 |
| commit | e513751ee9a9f9d737a0513b5bb0fac06274ede0 (patch) | |
| tree | c4853b7f46b6e88889fffe28d321e23106a55a68 | |
| parent | 2ecdbb62ae8f925b01e3e49f397d439a2f464a21 (diff) | |
Clean up 'inspector_break_on_first_line' test and fix its flakiness (#5098)
| -rw-r--r-- | cli/tests/inspector2.js | 3 | ||||
| -rw-r--r-- | cli/tests/integration_tests.rs | 26 |
2 files changed, 13 insertions, 16 deletions
diff --git a/cli/tests/inspector2.js b/cli/tests/inspector2.js index 34d8097d2..57f80ef94 100644 --- a/cli/tests/inspector2.js +++ b/cli/tests/inspector2.js @@ -1 +1,4 @@ console.log("hello from the script"); + +// This process will be killed before the timeout is over. +await new Promise((res, _) => setTimeout(res, 1000)); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index d4c58a685..dec3fe8ee 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2201,10 +2201,16 @@ async fn inspector_break_on_first_line() { .expect("Can't connect"); assert_eq!(response.status(), 101); // Switching protocols. - let (mut socket_tx, mut socket_rx) = socket.split(); + let (mut socket_tx, socket_rx) = socket.split(); + let mut socket_rx = + socket_rx.map(|msg| msg.unwrap().to_string()).filter(|msg| { + let pass = !msg.starts_with(r#"{"method":"Debugger.scriptParsed","#); + futures::future::ready(pass) + }); let stdout = child.stdout.as_mut().unwrap(); - let mut stdout_lines = std::io::BufReader::new(stdout).lines(); + let mut stdout_lines = + std::io::BufReader::new(stdout).lines().map(|r| r.unwrap()); use TestStep::*; let test_steps = vec