Repository navigation
feat: add ${cmake.testEnvironment} placeholder for CTest debug configurations - #4821
Merged
Merged
Conversation
… ENVIRONMENT in debug config (#4572) Co-authored-by: Omotola <8052624+Omotola@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [Feature] Support a new cmake.testEnvironment setting
Mar 16, 2026
…github.com/microsoft/vscode-cmake-tools into copilot/add-cmake-test-environment-support
Omotola
marked this pull request as ready for review
March 21, 2026 00:43
Contributor
Omotola
approved these changes
Mar 21, 2026
Garrett Campbell (gcampbell-msft)
previously approved these changes
Mar 24, 2026
Garrett Campbell (gcampbell-msft)
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This change addresses item #4572
This changes visible behavior
The following changes are proposed:
${cmake.testEnvironment}launch.json placeholder that resolves CTestENVIRONMENTtest properties (set viaset_tests_properties) into the[{ "name": "...", "value": "..." }]format expected by debug adaptersENVIRONMENTproperties into the debug config when debugging tests without a launch.jsontestEnvironment()parser toCTestDriverthat converts CTest's["A=B", "C=D"]format to a key-value mapreplaceValueInObject()helper for replacing string placeholders with non-string values (arrays/objects)Other Notes/Information
Usage in launch.json:
{ "name": "(ctest) Launch", "type": "cppdbg", "request": "launch", "program": "${cmake.testProgram}", "args": ["${cmake.testArgs}"], "cwd": "${cmake.testWorkingDirectory}", "environment": "${cmake.testEnvironment}" }Two debug paths are covered:
debugCTestImpl):${cmake.testEnvironment}is replaced with the environment array before launchingdebugCTestincmakeProject.ts): CTest environment is merged into the auto-generated debug config alongside the existing configure/launch environmentThe
cmake.testEnvironmentVS Code setting (for overriding CTest runtime env) already existed and is unrelated — this adds the per-testENVIRONMENTproperty resolution for debug sessions.Original prompt
cmake.testEnvironmentsimilar tocmake.testArgs#4572💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.