Skip to content

[Bug] Test explorer tree expand / collapse are reset when running test #4621

@automas-dev

Description

@automas-dev

Brief Issue Summary

I'm using the cmake.ctest.testSuiteDelimiter setting to view my gtests in the test explorer as a tree. When I run any of the tests, after expanding one of the tree elements, it will revert to the closed state. I am able to keep the tree open if I reload the window with the tree expanded, but then when I run a test after collapsing the tree it reverts to being expanded. It's almost like the tree has an initial state of what is expanded and running a test reverts to that state.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.106.2",
  "cmtVersion": "1.21.36",
  "configurations": [
    {
      "folder": "/home/thomas/projects/git/wavefront",
      "cmakeVersion": "3.31.6",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: wavefront 
[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ --no-warn-unused-cli -S /home/thomas/projects/git/wavefront -B /home/thomas/projects/git/wavefront/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Appending code coverage compiler flags: -g --coverage
[cmake] -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
[cmake] -- Doxygen not found, not building docs
[cmake] -- GLM: Version 1.0.2
[cmake] -- GLM: Build with C++ features auto detection
[cmake] Generate test parser_tests
[cmake] Generate test split_string_space_tests
[cmake] Generate test split_string_tests
[cmake] Generate test trim_string_tests
[cmake] -- Configuring done (0.4s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /home/thomas/projects/git/wavefront/build
[cmakefileapi-parser] Read reply folder: /home/thomas/projects/git/wavefront/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-141abae82097a8b1829c.json","cmakeFiles-v1-704e8308b8978291395b.json","codemodel-v2-93708a648829c7d0529c.json","directory-.-Debug-a6d278aab90e0d2a02df.json","directory-_deps.glm-build-Debug-201ada10ea0a1b5f163e.json","directory-_deps.glm-build.glm-Debug-894397eaf2e95b475181.json","directory-_deps.googletest-build-Debug-325181791364522dc3de.json","directory-_deps.googletest-build.googletest-Debug-de7a7819599cf3ddfbd1.json","directory-external-Debug-c957a038f5114282bdaf.json","directory-src-Debug-1ff04ebb6bc18e202804.json","directory-tests-Debug-b01f6abb0ab61427ef3b.json","index-2025-11-27T05-43-07-0683.json","target-Continuous-Debug-7123eaa45a0f21e2e564.json","target-ContinuousBuild-Debug-256a00903484a043ee44.json","target-ContinuousConfigure-Debug-005a0ca7cc6184dda912.json","target-ContinuousCoverage-Debug-621f6e3f87ca0525aeef.json","target-ContinuousMemCheck-Debug-e1082d2f68a1a465d7ca.json","target-ContinuousStart-Debug-0b60030b120c7685d6bf.json","target-ContinuousSubmit-Debug-a8cc13e6f4fe3b319832.json","target-ContinuousTest-Debug-b85fcbb89dc7a1602dd9.json","target-ContinuousUpdate-Debug-3601c895f88a0a9e67b3.json","target-Experimental-Debug-5c36a760f8f38a7a84fc.json","target-ExperimentalBuild-Debug-51859c69abdb99ed2d68.json","target-ExperimentalConfigure-Debug-83d7e96476b21ea9924e.json","target-ExperimentalCoverage-Debug-023db6e34b41d985c6fe.json","target-ExperimentalMemCheck-Debug-46c91d21a9c1d4139604.json","target-ExperimentalStart-Debug-c14cda818c18fcdc0484.json","target-ExperimentalSubmit-Debug-e68e1b0dddd193627a52.json","target-ExperimentalTest-Debug-08aed19ce815ff708c8a.json","target-ExperimentalUpdate-Debug-f7584eb1a7b988cbd0f7.json","target-Nightly-Debug-cb618877903e906e6b48.json","target-NightlyBuild-Debug-666e3e8ad2066a894708.json","target-NightlyConfigure-Debug-0fb6c98cb412a5327776.json","target-NightlyCoverage-Debug-aa31cc5359e7e75942ee.json","target-NightlyMemCheck-Debug-ee0b853b506a175d8432.json","target-NightlyMemoryCheck-Debug-817c465b10017ea3555b.json","target-NightlyStart-Debug-14a6ca831d1cfc8f9120.json","target-NightlySubmit-Debug-6eb18a1b7d8b947412d7.json","target-NightlyTest-Debug-34ada32f0f762706897a.json","target-NightlyUpdate-Debug-4645a5b8528b4a53da13.json","target-Wavefront-Debug-4bc07bd9bcb9f506ab1c.json","target-Wavefront_coverage-Debug-2713171a5ffb808c4650.json","target-glm-Debug-04b1b24297b173f0e748.json","target-gtest-Debug-771b0422447fe63824d6.json","target-gtest_main-Debug-8a723abd9ef076aa3b59.json","target-parser_tests-Debug-9df7c88a9a9607dee34d.json","target-split_string_space_tests-Debug-69c8ba720148bfab5e07.json","target-split_string_tests-Debug-d6403791e37e4afbbf95.json","target-trim_string_tests-Debug-f948a660fc2b84c77397.json","toolchains-v1-16c0cf49103c78f1ab95.json"]
[extension] [3428] cmake.configure finished (returned 0)

Additional Information

In an effort to trace the issue, I reverted all of my vscode settings to default and disabled all extensions besides CMake Tools, Test Explorer UI and Test Adapter Converter. This recording and all logs are from that setup.

Image

Test cases in the above recording are

  1. Run all after loading the workspace (nothing changes)
  2. Run all tests after collapsing and expanding elements of the tree (both are reset)
  3. Running a single test from another group after expanding (expanded is reset)
  4. Running a single test from the expanded group after expanding (expanded is reset)

Logs from running all tests: run_all_tests_cmake_build_output.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    Status

    Blocked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions