From af13902d2745c43a8ec017dca0c21287dd454d36 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 3 Mar 2025 14:09:17 -0800 Subject: [PATCH] respect existing serverReadyAction in launch config --- .../configuration/resolvers/launch.ts | 6 +++- .../resolvers/launch.unit.test.ts | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/extension/debugger/configuration/resolvers/launch.ts b/src/extension/debugger/configuration/resolvers/launch.ts index ec8fa60e..85e89208 100644 --- a/src/extension/debugger/configuration/resolvers/launch.ts +++ b/src/extension/debugger/configuration/resolvers/launch.ts @@ -146,7 +146,11 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { }); }); + test('Preserve serverReadyAction when already defined in configuration', async () => { + const pythonPath = `PythonPath_${new Date().toString()}`; + const workspaceFolder = createMoqWorkspaceFolder(__dirname); + const pythonFile = 'xyz.py'; + setupIoc(pythonPath); + setupActiveEditor(pythonFile, PYTHON_LANGUAGE); + + const customServerReadyAction = { + pattern: '.*Running on (http://\\S+:[0-9]+).*', + uriFormat: '%s/custom', + action: 'debugWithChrome', + }; + + testsForautoStartBrowser.forEach(async (testParams) => { + const debugConfig = await resolveDebugConfiguration(workspaceFolder, { + ...launch, + ...testParams, + serverReadyAction: customServerReadyAction, + }); + + expect(debugConfig).to.have.property('serverReadyAction', customServerReadyAction); + if (!debugConfig) { + throw new Error('Debug config is undefined'); + } + expect(debugConfig.serverReadyAction).to.deep.equal(customServerReadyAction); + expect(debugConfig.serverReadyAction).to.not.deep.equal({ + pattern: '.*(https?:\\/\\/\\S+:[0-9]+\\/?).*', + uriFormat: '%s', + action: 'openExternally', + }); + }); + }); + test('Send consoleName value to debugpy as consoleTitle', async () => { const consoleName = 'My Console Name'; const pythonPath = `PythonPath_${new Date().toString()}`;