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

Use custom test script instead of the go binary #2746

Closed
Yekut opened this issue Sep 11, 2019 · 7 comments
Closed

Use custom test script instead of the go binary #2746

Yekut opened this issue Sep 11, 2019 · 7 comments

Comments

@Yekut
Copy link

Yekut commented Sep 11, 2019

In our current project, there are a bunch of setup commands that needs to be run before running tests, so we wrap them in a setup script that ends with go test. There doesn't seem to be support for this workflow in vscode-go (happy to be pointed out wrong) - is it something worth considering?

A few extra comments:

  1. The script is more than just environment variables (which it seems can be setup) - it also has codegen and other stuff in it.
  2. If this feature request is too fringe, we might be able to set things up so we can run codegen separately and support the env vars through the existing config - however, the env vars are stored in an env file - not sure if there's a nice way to support that? Happy to open another issue - if this issue is valid then this point is moot anyway.

(Also would be happy to try to provide a patch if this is something worth doing!)

@wtask
Copy link

wtask commented Sep 11, 2019

You may to use make or similar tool to prepare your environment, build containers, start tests and so on. Of course, you can open a terminal window and start your workflow from VSCode. For my opinion this is enough in 100% cases. Otherwise use monsters like IDEA.

@Yekut
Copy link
Author

Yekut commented Sep 12, 2019

@wtask - thanks for the suggestions - they are pretty much all in our toolbox now. I looked through the source code and figured this wouldn't be a hard thing to add, and IDEA does mean ~600 USD per developer. I would be a bit surprised if the VSCode team's response is "go use GoLand" :-) But if that's the case I'll respect the decision.

@ramya-rao-a
Copy link
Contributor

@Yekut Have you considered using tasks for your scenario?

Regarding the question on env file, there is a setting go.testEnvFile that you can use to provide the path to the env file to use when running tests

@Yekut
Copy link
Author

Yekut commented Sep 15, 2019

@ramya-rao-a That's a good point, thanks! Didn't know tasks exist at all - was only looking at vscode-go and forgot about core vscode features. I'll try it and see if it works out, thanks!

@Yekut
Copy link
Author

Yekut commented Sep 20, 2019

So I've been trying this out and it seems there's no way to hook this up with vscode-go's coverage tool since it loads the cover file from a tmp dir (unless we can configure the cover file location?) :-( Other than that this seems like it would work. I'll look into it more and if I get it to work will close this out.

@ramya-rao-a
Copy link
Contributor

#1596 tracks the need to configure the test coverage feature to use an existing cover file, so may be that can help?

@ramya-rao-a
Copy link
Contributor

Closing this issue as there is no action item at present other than what #1596 is tracking.
There is PR associated with it, so that feature might come along in the next update or the one after that. So, please subscribe to #1596 to get notified of the progress

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants