-
Notifications
You must be signed in to change notification settings - Fork 758
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 a command to run test with custom value for -run
flag
#1734
Comments
Thanks for the feature request. This makes sense to me, but is probably not going to be a high priority for the team right now (will discuss with others in our weekly triage meeting). Added 'help wanted' as I think this would be relatively straightforward to contribute. |
@findleyr Can I have a go at it? Though I would need some guidance to get started. |
Sure, though I think @hyangah or @firelizzard18 might be better able to advise on how to get started. |
As I see it, today the main advantage of adding this command over running the equivalent on the command line is integration with @n1lesh The main problem will be deciding the current directory and/or packages to test. In a single workspace environment, you could set the CWD to the workspace root and test all packages ( For the actual implementation, I would change the type of the const goConfig = getGoConfig(packageDirUri);
const isMod = await isModSupported(packageDirUri);
const testConfig: TestConfig = {
goConfig,
dir: packageDirUri.fsPath,
flags: getTestFlags(goConfig, args),
functions: userSuppliedRunFlagArgument,
isMod,
};
// Remember this config as the last executed test.
lastTestConfig = testConfig;
return goTest(testConfig); EDIT: I fixed the link to |
@firelizzard18 I guess it's better to implement it at the current active package level for the reasons you mentioned. Just one question, to run the custom |
@n1lesh I meant |
@firelizzard18 Got it and thanks for all your suggestions and feedback. |
Change https://golang.org/cl/347209 mentions this issue: |
I have tested the patch in 347209 and while it may do what it says, I find it very limited. A frequent thing for me is to rerun a test (or test case) until I have fixed it. The above command allows me to run a specific test case, but I constantly need to paste in the |
@bep I wouldn't know if we can keep the initial command cached for the user to re-use it, if that's what you're looking for. @firelizzard18 Would you be able to suggest something on this? |
@n1lesh yes, something like that ... I tested that and that works kind of naturally ... until you switch to another package. But I guess that's an OK compromise. |
"Go: Test Previous" (and also Debug Previous) is the command for the purpose and it seems the current CL does it already. |
Related issues
Is your feature request related to a problem? Please describe.
Until this extension can run 'subtest at cursor' reliably (#1602), an easier and more flexible way to allow people to run arbitrary subtests is to add a "Test -run" command that allows people to run tests with a custom value for
-run
flag. I think this command will still remain useful even when 'subtest at cursor' command can run reliably because you can write regexp to match and run multiple subtests at any level, not just one specific subtest under your cursor.Describe the solution you'd like
Add a command that works like "Test Package" except it should show an input box that allows specifying a custom value for
-run
flag before running tests. Subsequent runs of this command should remember the previous value to make typing minimal.The text was updated successfully, but these errors were encountered: