Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commands to get current selected tests/profiles #179065

Closed
connor4312 opened this issue Apr 3, 2023 · 4 comments · Fixed by #179076
Closed

Add commands to get current selected tests/profiles #179065

connor4312 opened this issue Apr 3, 2023 · 4 comments · Fixed by #179076
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders testing Built-in testing support verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@connor4312
Copy link
Member

connor4312 commented Apr 3, 2023

Expose API commands to get the currently selected tests and profiles

  • vscode.commands.executeCommand('testing.getSelectedProfiles') -> { controllerId: string, kind: TestrunProfileKind, label: string }[]
  • vscode.commands.executeCommand('testing.getExplorerSelection') -> { include: TestItem[], exclude: TestItem[] } (like a TestRunRequest)
@connor4312 connor4312 added feature-request Request for new features or functionality testing Built-in testing support labels Apr 3, 2023
@connor4312 connor4312 added this to the April 2023 milestone Apr 3, 2023
@connor4312 connor4312 self-assigned this Apr 3, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Apr 4, 2023
@connor4312 connor4312 added the verification-needed Verification of issue is requested label Apr 25, 2023
@connor4312
Copy link
Member Author

You can test this by modifying the selfhost test provider extension

@roblourens roblourens added the verified Verification succeeded label Apr 26, 2023
@MDcod
Copy link

MDcod commented May 3, 2023

@connor4312 Hello!
I found unexpected behavior for new command testing.getExplorerSelection. If I run tests using the "Run tests" button from menu header, I get this object from command:

exclude: (0) []
include: (1) [{…}]
  0: {items: {…}, label: <accessor>, refreshHandler: <accessor>, id: <accessor>, createRunProfile: ƒ, …}
      createRunProfile: (Ee,he,fe,x,B,Z)=>{let pe=(0,D.hash)(Ee);for(;_.has(pe);)pe++;return new M(this.f,_,z,pe,Ee,he,fe,x,B,Z)}
      createTestItem: ƒ createTestItem(Ee,he,fe){return new v.TestItemImpl(z,Ee,he,fe)}
      createTestRun: (Ee,he,fe=!0)=>this.g.createTestRun(z,Y,Ee,he,fe)
      dispose: ()=>{$.dispose()}
      id: ƒ id(){return z}
      items: {size: <accessor>, forEach: ƒ, replace: ƒ, add: ƒ, delete: ƒ, …}
      label: ƒ label(){return G}
      refreshHandler: ƒ refreshHandler(){return F}
      resolveHandler: ƒ resolveHandler(){return Y.resolveHandler}

That is, in the include, I always get an array from one TestController object. This is fine?

details:
Version: 1.78.0-insider (user setup)
Commit: 657bb89
Date: 2023-05-02T11:21:33.752Z
Electron: 22.4.8
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: Yes

@MDcod
Copy link

MDcod commented May 3, 2023

The second point, which completely prevents the use of this task as a workaround for this bug.

If you clicked on a test case, didn't just run a click, and then run another test case, the result of the 'testing.getExplorerSelection' command will be the previous test case where the selector was left. And accordingly, if you had a filter, you will not see it in this command.

I understand that, judging by the name of the command, this is exactly the behavior you wanted to get. But how then to get around the bug that I indicated above?

@connor4312
Copy link
Member Author

That is, in the include, I always get an array from one TestController object. This is fine?

Yea, that is by design

But how then to get around the bug that I indicated above?

Well the bug just needs to be fixed, there's not a workaround available

@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders testing Built-in testing support verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants