From 08d03a75a39bb7a6176b46a3e18edd8250cfb743 Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Wed, 19 Aug 2026 09:04:12 -0700 Subject: [PATCH] Do not end the debug session after a setup snippet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A test item with `setup=[...]` debugs its snippets and then its own body, as separate `debug_code` calls on one debug session. `debug_code` sends a `terminated` event when the code it was given finishes, and a client takes that as "the debuggee has ended" and disconnects — so the session was already gone by the time the test item's body ran, and no breakpoint in the item was ever hit. Breakpoints inside the snippet worked, which is what made the symptom confusing. Snippets now pass `notify_termination=false`, so only the item's own body reports termination. Requires DebugAdapter 3.2, which adds the keyword argument (julia-vscode/DebugAdapter.jl#122), to be released and vendored first. Closes julia-testitems/TestItemRunner.jl#107 --- testprocess/TestItemServer/src/TestItemServer.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testprocess/TestItemServer/src/TestItemServer.jl b/testprocess/TestItemServer/src/TestItemServer.jl index 5b6c69e..6d127bf 100644 --- a/testprocess/TestItemServer/src/TestItemServer.jl +++ b/testprocess/TestItemServer/src/TestItemServer.jl @@ -743,7 +743,12 @@ function _run_testitem(endpoint, params::TestItemServerProtocol.RunTestItem, mod withpath(testsnippet_filepath) do if mode == "Debug" debug_session = wait_for_debug_session() - DebugAdapter.debug_code(debug_session, mod, testsnippet_code, testsnippet_filepath) + # A setup snippet is not the last thing this session debugs — the + # test item's own body follows — and `terminated` would tell the + # client the debuggee has ended, so it would disconnect before the + # body ran and no breakpoint in the item would ever be hit + # (julia-testitems/TestItemRunner.jl#107). + DebugAdapter.debug_code(debug_session, mod, testsnippet_code, testsnippet_filepath; notify_termination=false) else mode == "Coverage" && clear_coverage_data() # A snippet is re-evaluated into every item's scope, so its output