microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.63k stars 28.67k forks source link

Can't run a runnable test item with a single non-runnable child #229120

Open firelizzard18 opened 2 hours ago

firelizzard18 commented 2 hours ago

Type: Bug

Using the testing API:

  1. Create run profile with tag id: runnable.
  2. Create test item A including tag id: runnable and add it to the root or some other collection.
  3. Create test item B without the runnable tag and add it as a child to A.
  4. Attempt to run test item A.

VS Code version: Code 1.93.1 (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z) OS version: Linux x64 6.6.21-gentoo Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz (20 x 4799)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|62.61GB (50.72GB free)| |Process Argv|--ozone-platform-hint=auto --enable-wayland-ime --crash-reporter-id 217c2155-7214-48e7-83e7-a2317fced1b9| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|plasma| |XDG_CURRENT_DESKTOP|KDE| |XDG_SESSION_DESKTOP|KDE| |XDG_SESSION_TYPE|wayland|
Extensions (77) Extension|Author (truncated)|Version ---|---|--- language-x86-64-assembly|13x|3.1.4 golangwithdidi|ald|0.0.1 Bookmarks|ale|13.5.0 chronicler|arc|0.1.16 quitcontrol-vscode|art|4.0.0 unique-lines|bib|1.0.0 markdown-mermaid|bie|1.25.0 esbuild-problem-matchers|con|0.0.3 systemd-unit-file|coo|1.0.6 vscode-eslint|dba|3.0.10 xml|Dot|2.5.1 udev-rules|dpk|1.0.1 gitlens|eam|15.5.1 permute-lines|ear|1.1.0 EditorConfig|Edi|0.16.4 prettier-vscode|esb|11.0.0 go-notebook-kernel|eth|0.2.0 go-playbooks|eth|0.0.3 simple-notebook-renderers|eth|0.1.1 vscode-firefox-debug|fir|2.9.10 copilot|Git|1.232.0 copilot-chat|Git|0.20.3 remotehub|Git|0.64.0 gitlab-workflow|Git|5.12.0 gitpod-desktop|git|0.0.174 go|gol|0.42.1 vscode-graphql|Gra|0.12.0 vscode-graphql-execution|Gra|0.3.0 vscode-graphql-syntax|Gra|1.3.6 vscode-test-explorer|hbe|2.21.1 vscode-ansi|ili|1.1.7 vscode-go-template|jin|0.2.1 solidity|Jua|0.0.176 vscode-clangd|llv|0.1.29 bash-ide-vscode|mad|1.42.0 rainbow-csv|mec|3.12.0 template-string-converter|meg|0.6.1 graphql|mqu|0.1.2 vscode-docker|ms-|1.29.1 csharp|ms-|2.45.25 vscode-dotnet-runtime|ms-|2.1.5 debugpy|ms-|2024.10.0 python|ms-|2024.14.1 vscode-pylance|ms-|2024.9.1 jupyter|ms-|2024.8.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.384.0 remote-ssh|ms-|0.114.3 remote-ssh-edit|ms-|0.86.0 cmake-tools|ms-|1.19.52 hexeditor|ms-|1.10.0 remote-explorer|ms-|0.4.3 remote-repositories|ms-|0.42.0 test-adapter-converter|ms-|0.1.9 vscode-markdown-notebook|ms-|0.0.26 vscode-serial-monitor|ms-|0.13.1 wasm-dwarf-debugging|ms-|1.0.1 vsliveshare|ms-|1.0.5940 vsliveshare-pack|ms-|0.4.0 linux-desktop-file|nic|0.0.21 vscode-jest|Ort|6.2.5 material-icon-theme|PKi|5.10.0 vscode-xml|red|0.27.1 vscode-yaml|red|1.15.0 bash-beautify|sha|0.1.1 shader|sle|1.1.5 rewrap|stk|1.16.3 code-spell-checker|str|3.0.1 even-better-toml|tam|0.19.2 vscode-tinygo|tin|0.5.0 cmake|twx|0.0.17 vscode-mdx|uni|1.8.11 spice|xua|0.1.0 vscode-proto3|zxh|0.5.5
firelizzard18 commented 2 hours ago

I verified this in the extension host, and by debugging vscode with vscode and installing my extension as a VSIX into the running-in-a-debugger vscode. I generated the report from the host/top vscode which is why it shows all those extensions.

The behavior is coming from this function: https://github.com/microsoft/vscode/blob/6b924c51528e663dda5091a1493229a361676aca/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts#L166-L201

I'm not going to pretend to understand why inTree.visibleChildrenCount !== 1 is there but the end result is that test item A does not get added to the include set. This is tolerable when test item B is runnable, because at the very least I can explicitly transform a request to run B into a request to run A, but if B is not runnable it just does nothing because the include set ends up empty and it never even calls the extension's run profile. Personally I don't like this behavior - if the user clicks run on test item A, then vscode should tell the extension "the user wishes to run test item A". But instead, the user clicks on A and vscode says "the user wishes to run B", which is surprising in a bad way to me. But ultimately, it wouldn't break anything for me except for the fact that this still happens when B is not runnable.

CC @connor4312