Enable testflags via settings and keyboard bindings#482
Enable testflags via settings and keyboard bindings#482ramya-rao-a merged 1 commit intomicrosoft:masterfrom
Conversation
ironcladlou
left a comment
There was a problem hiding this comment.
Let's talk about buildFlags in the context of this change...
| let buildTags: string = vscode.workspace.getConfiguration('go')['buildTags']; | ||
| let args = ['test', '-v', '-timeout', config.timeout, '-tags', buildTags, ...buildFlags]; | ||
| let testFlags: string[] = vscode.workspace.getConfiguration('go')['testFlags']; | ||
| let args = ['test', ...testFlags, '-timeout', config.timeout, '-tags', buildTags, ...buildFlags]; |
There was a problem hiding this comment.
I like the idea of using testFlags for build/test flags to the test command. Should we remove support for buildFlags here, given there is no distinction in go test between build and test flags? Having both is redundant and confusing to me given your new option.
There was a problem hiding this comment.
Agreed. Ideally
buildFlagsshould be used for build only,testFlagsshould be used for test only.testTimeoutshould not be a separate setting and should be included in thetestFlagssetting
If we do this, we won't be backward compatible and everyone who had configured buildFlags and/or testTimeout will have to update their settings to add the new testFlags
@lukehoban Thoughts?
There was a problem hiding this comment.
testTimeout should not be a separate setting and should be included in the testFlags setting
Hm. Wouldn't it then follow that buildTags should be merged into buildFlags? After all, -tag is just another buildFlag. I do see value in adding convenient strongly typed wrappers around the most common flags, but those would need to be easily omitted so that users can have absolute control over flags.
0b2155b to
7aa5605
Compare
5a1eb8f to
6ff686f
Compare
|
cc @roblourens |
|
LGTM |
6ff686f to
325b84f
Compare
|
@ironcladlou I wish you had a chance to look at this PR. I am planning to release an update in a few days, therefore will go ahead and merge this PR so that I can do some end to end testing. When you get some time, please do add your thoughts here. |
(Updated on 21/1/2017)
Fixes #401 and #683
Added a new setting
go.testFlags- If null, then all the test commands will continue to use the
go.buildFlagsand '-v' while runninggo testas always.- Else, the provided flags will be used by the test commands instead of
go.buildFlagswhile runninggo testThe usage of
go.testTimeoutandgo.buildTagswill continue to remain as is.Users can also customize the flags and have keyboard shortcuts for the same.
{ "key": "ctrl+shift+t", "command": "go.test.file", "args": { "flags": ["-short"] }, "when": "editorTextFocus" }