Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/extension/debugger/configuration/resolvers/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
}
const isFastAPI = LaunchConfigurationResolver.isDebuggingFastAPI(debugConfiguration);
const isFlask = LaunchConfigurationResolver.isDebuggingFlask(debugConfiguration);
if (debugConfiguration.autoStartBrowser && (debugConfiguration.django || isFlask)) {
if (
debugConfiguration.autoStartBrowser &&
(debugConfiguration.django || isFlask) &&
!debugConfiguration.serverReadyAction
) {
debugConfiguration.serverReadyAction = {
pattern: '.*(https?:\\/\\/\\S+:[0-9]+\\/?).*',
uriFormat: '%s',
Expand Down
33 changes: 33 additions & 0 deletions src/test/unittest/configuration/resolvers/launch.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,39 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
});
});

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()}`;
Expand Down