-
Notifications
You must be signed in to change notification settings - Fork 645
Enable testflags via settings and keyboard bindings #482
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about buildFlags
in the context of this change...
@@ -122,7 +122,8 @@ function goTest(config: TestConfig): Thenable<boolean> { | |||
outputChannel.show(2); | |||
let buildFlags: string[] = vscode.workspace.getConfiguration('go')['buildFlags']; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Ideally
buildFlags
should be used for build only,testFlags
should be used for test only.testTimeout
should not be a separate setting and should be included in thetestFlags
setting
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.buildFlags
and '-v' while runninggo test
as always.- Else, the provided flags will be used by the test commands instead of
go.buildFlags
while runninggo test
The usage of
go.testTimeout
andgo.buildTags
will continue to remain as is.Users can also customize the flags and have keyboard shortcuts for the same.