diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-11-27 00:44:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-27 00:44:39 +0100 |
commit | d4f659d1d3caa550dfc15ca9e62d4ad6a31db7ac (patch) | |
tree | 55479431116f0d70b156728a4c648ded7924aa01 /cli/tests | |
parent | 6344b9e0a5a9cc434953c16d3dc6a6e4f052d4dd (diff) |
feat(core): send "executionContextDestroyed" notification on program end (#16831)
This commit changes "JsRuntime" to send "executionContextDestroyed"
notification when the program finishes and shows a prompt informing
that runtime is waiting for inspector to disconnect.
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/inspector_tests.rs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/cli/tests/inspector_tests.rs b/cli/tests/inspector_tests.rs index febff7c28..94ebbb205 100644 --- a/cli/tests/inspector_tests.rs +++ b/cli/tests/inspector_tests.rs @@ -303,7 +303,6 @@ mod inspector { .unwrap(); let msg = ws_read_msg(&mut socket).await; - println!("response msg 1 {}", msg); assert_starts_with!(msg, r#"{"id":6,"result":{"debuggerId":"#); socket @@ -312,7 +311,6 @@ mod inspector { .unwrap(); let msg = ws_read_msg(&mut socket).await; - println!("response msg 2 {}", msg); assert_eq!(msg, r#"{"id":31,"result":{}}"#); child.kill().unwrap(); @@ -546,6 +544,10 @@ mod inspector { .filter(|s| !s.starts_with("Deno ")); assert_stderr_for_inspect(&mut stderr_lines); + assert_eq!( + &stdout_lines.next().unwrap(), + "exit using ctrl+d, ctrl+c, or close()" + ); assert_inspector_messages( &mut socket_tx, @@ -564,11 +566,6 @@ mod inspector { ) .await; - assert_eq!( - &stdout_lines.next().unwrap(), - "exit using ctrl+d, ctrl+c, or close()" - ); - assert_inspector_messages( &mut socket_tx, &[ @@ -577,7 +574,6 @@ mod inspector { &mut socket_rx, &[r#"{"id":3,"result":{}}"#], &[] ).await; - assert_inspector_messages( &mut socket_tx, &[ @@ -587,7 +583,6 @@ mod inspector { &[r#"{"id":4,"result":{"result":{"type":"string","value":""#], &[], ).await; - assert_inspector_messages( &mut socket_tx, &[ @@ -597,9 +592,7 @@ mod inspector { &[r#"{"id":5,"result":{"result":{"type":"undefined"}}}"#], &[r#"{"method":"Runtime.consoleAPICalled"#], ).await; - assert_eq!(&stderr_lines.next().unwrap(), "done"); - drop(stdin); child.wait().unwrap(); } @@ -905,6 +898,26 @@ mod inspector { assert_eq!(&stdout_lines.next().unwrap(), "hello"); assert_eq!(&stdout_lines.next().unwrap(), "world"); + assert_inspector_messages( + &mut socket_tx, + &[], + &mut socket_rx, + &[], + &[ + r#"{"method":"Debugger.resumed","params":{}}"#, + r#"{"method":"Runtime.consoleAPICalled","#, + r#"{"method":"Runtime.consoleAPICalled","#, + r#"{"method":"Runtime.executionContextDestroyed","params":{"executionContextId":1}}"#, + ], + ) + .await; + let line = &stdout_lines.next().unwrap(); + + assert_eq!( + line, + "Program finished. Waiting for inspector to disconnect to exit the process..." + ); + child.kill().unwrap(); child.wait().unwrap(); } |