diff --git a/test/support/protocol_test_case.rb b/test/support/protocol_test_case.rb index 902955c0d..b92b0bb56 100644 --- a/test/support/protocol_test_case.rb +++ b/test/support/protocol_test_case.rb @@ -175,12 +175,16 @@ def req_step_back end def req_terminate_debuggee + # Kernel#exit method will be called when the debuggee receives the following method. case get_target_ui when 'vscode' send_dap_request 'terminate' when 'chrome' send_cdp_request 'Runtime.terminateExecution' end + # Ensure debuggee exit by waiting for Kernel#exit in server_cdp.rb to complete. + # This `wait_pid` is called to prevent disconnection before the debuggee exits. + flunk create_protocol_msg test_info, "Expected the debuggee program to finish" unless wait_pid @remote_info.pid, 3 close_reader end