Skip to content

Modify error string "Could not load unit test config from launch.json" to be more specific about which fields are missing #14381

@cdleonard

Description

@cdleonard

I had a lot of trouble getting "justMyCode" = false to work because I kept getting "Could not load unit test config from launch.json". This was despite that fact that launch configs showed up fine in the debug configuration dropdown and that debugging worked.

The issue was a missing "version" attribute in launch.json but I had to read the source to find this. I'm posting an issue hoping that the error message is improved or maybe it helps somebody else, this error bugged me for quite a while.

The following message is seen in "Python" output tab:

Error 2020-10-13 02:54:01: could not get debug config [Error: malformed launch.json
	at _.readAllDebugConfigs (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:931824)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async _.readDebugConfig (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:932663)
	at async _.getLaunchArgs (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:932363)
	at async _.launchDebugger (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:931326)
	at async h.runTest (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:1036991)
	at async c.runTestImpl (/home/leonard/.vscode-oss/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:1034988)]

Exception is thrown from here: https://github.com/microsoft/vscode-python/blob/main/src/client/testing/common/debugLauncher.ts#L58

You can probably reproduce this by removing "version" from launch.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-debuggingdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.good first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions