src/goTest: show test output on run
By default, open the test UI output terminal when starting a test run.
This can be overriden with a setting. This brings the test explorer UX
more in line with the other testing support (which opens an output
channel).
Change-Id: Ib0edeebc94c6ece26a00d54696189bf67ed28880
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/352309
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/docs/settings.md b/docs/settings.md
index 37f2bcc..e01ced9 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -410,6 +410,11 @@
Set the source location of dynamically discovered subtests to the location of the containing function. As a result, dynamically discovered subtests will be added to the gutter test widget of the containing function.
Default: `false`
+### `go.testExplorer.showOutput`
+
+Open the test output terminal when a test run is started.
+
+Default: `true`
### `go.testFlags`
Flags to pass to `go test`. If null, then buildFlags will be used. This is not propagated to the language server.
diff --git a/package.json b/package.json
index 22c01a9..e3ed825 100644
--- a/package.json
+++ b/package.json
@@ -1332,6 +1332,12 @@
"description": "Set the source location of dynamically discovered subtests to the location of the containing function. As a result, dynamically discovered subtests will be added to the gutter test widget of the containing function.",
"scope": "resource"
},
+ "go.testExplorer.showOutput": {
+ "type": "boolean",
+ "default": true,
+ "description": "Open the test output terminal when a test run is started.",
+ "scope": "window"
+ },
"go.generateTestsFlags": {
"type": "array",
"items": {
diff --git a/src/goTest/run.ts b/src/goTest/run.ts
index a004be2..d2f1a17 100644
--- a/src/goTest/run.ts
+++ b/src/goTest/run.ts
@@ -255,8 +255,13 @@
return isInMod(item.parent);
}
- let success = true;
const run = this.ctrl.createTestRun(request);
+ const windowGoConfig = getGoConfig();
+ if (windowGoConfig.get<boolean>('testExplorer.showOutput')) {
+ await vscode.commands.executeCommand('testing.showMostRecentOutput');
+ }
+
+ let success = true;
const subItems: string[] = [];
for (const [pkg, items] of collected.entries()) {
const isMod = isInMod(pkg) || (await isModSupported(pkg.uri, true));