Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Coverage on a single file (via run file tests) #2873

Closed
cristaloleg opened this issue Oct 31, 2019 · 2 comments · Fixed by #2884
Closed

Coverage on a single file (via run file tests) #2873

cristaloleg opened this issue Oct 31, 2019 · 2 comments · Fixed by #2884

Comments

@cristaloleg
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When I'm running tests from 1 specific file (via run file tests on the top of the file), the coverage isn't calculated.

Describe the solution you'd like
run file tests should use the same configuration as run single test ( "go.coverOnSingleTest" see #1637)

Describe alternatives you've considered
A new configuration param, probably "go.coverOnSingleTestFile"

Additional context
Nothing to add.

@ramya-rao-a
Copy link
Contributor

We have settings for applying coverage when tests in entire package is run and when a single test is run

  • go.coverOnTestPackage
  • go.coverOnSingleTest

PRs are most welcome to add another setting go.coverOnSingleTestFile to extend this feature to apply to when tests in the file are run.

Code Pointers:

  • Set a local dev environment of the extension
  • goTest.ts is the file where you should start. Look at how the 2 above features are implemented in the testCurrentPackage and runTestAtCursor functions.
  • The function testCurrentFile is the function to tweak to add the same feature to testing files

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 25, 2019
@ramya-rao-a
Copy link
Contributor

The latest version of this extension (0.12.0) has this feature now.
Use the setting go.coverOnSingleTestFile to enable it.

Thanks to @cristaloleg for reporting and for the PR as well :)

Happy Coding!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants