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

Test: Test Related Code #223150

Closed
2 tasks done
connor4312 opened this issue Jul 22, 2024 · 6 comments
Closed
2 tasks done

Test: Test Related Code #223150

connor4312 opened this issue Jul 22, 2024 · 6 comments

Comments

@connor4312
Copy link
Member

connor4312 commented Jul 22, 2024

ref #126932

Complexity: 2

Create Issue


This iteration, I've added some API and UI to support relating code and its tests. I've adopted this for the selfhost test provider that we use in VS Code. Note that that the selfhost test provider has a basic, import-based implementation of related code. Please don't judge the relevancy of results it provides, just the editor functionality!

  • Open VS Code and install the @recommended selfhost test provider if you haven't yet
  • In some implementation code, right click and "Go to Related Test" / "Peek > Peek Related Test". Verify the UI displays well for you.
  • If you have code not imported by any tests anywhere, then you will get a cursor hint.
  • In some test code, verify the opposite, that "Go to Related Code" / "Peek > Peek Related Code" works.
  • In some implementation code, verify that Test: Run Test at Cursor runs the tests found via related code
@aiday-mar
Copy link
Contributor

Hi @connor4312 I am trying to follow the steps of this TPI. I have installed the extension, I right click on code that is imported into a test, but I do not see under the Peek category, the Peek Related Test command, or the opposite Peek Related Code command. Here is a screen recording of what I see. Let me know if there is something I am missing,

Screen.Recording.2024-07-23.at.10.06.48.mov

@aiday-mar aiday-mar added the blocked TPI is blocked label Jul 23, 2024
@aiday-mar
Copy link
Contributor

After discussion with colleagues, they suggested this could be happening because I was not on the main branch during testing. I switched to the main vscode branch and pulled main, then I reloaded the window. After doing this I saw the command appear in the context menu.

@aiday-mar aiday-mar removed the blocked TPI is blocked label Jul 23, 2024
@aiday-mar
Copy link
Contributor

After testing two thoughts come to mind:

  • I wonder if the phrasing of Test: Run Test at Cursor for running the tests wherein the code appears, could be improved. There can be several tests, not just one, where the code appears and there is no test per say under the cursor, just code that appears in the test. Perhaps a phrase like Test: Run Associated Tests at Cursor would be better.
  • I tested the feature on a function, let's call it A, that was not exported into any testing file. When clicking on Peek Related Test, it opened the testing file where a function B that uses A was used. A itself however was not called in the test. I was wondering if this is expected? I am asking since you mention in your third bullet point that in this case I should get a cursor hint instead. The screen recording of what I saw more specifically.
Screen.Recording.2024-07-23.at.14.01.52.mov

@aiday-mar aiday-mar removed their assignment Jul 23, 2024
@cwebster-99
Copy link
Member

Hey @connor4312, I am trying to test this and running into a couple of issues.
I tried testing in Codespaces first but am not seeing any options after installing the extension and ensuring I am on the main branch per the comments above.
image

I also tried to test this locally, but running into an issue with activating the extension
image

Are there additional setup/config steps I need to take to get these options?

@connor4312
Copy link
Member Author

connor4312 commented Jul 23, 2024

Please ensure you're using today's Insiders (22e3447).

Running locally you also will have needed to yarn watch to compile built-in extensions including the selfhost test provider

@cwebster-99 cwebster-99 assigned luabud and unassigned cwebster-99 Jul 23, 2024
@cwebster-99
Copy link
Member

Swapping with @luabud due to limitations of my machine

@rzhao271 rzhao271 assigned rzhao271 and unassigned luabud and rzhao271 Jul 23, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants