src/testUtils.ts: always run test in package list mode

During v0.16 dev cycle, we switched tests to run in local directory
mode by not specifying the target package path to be tested.

This has two unintended side-effects:

1) prints all stderr/stdout from the tested target when tests succeed.
2) disables test caching.

Whether `Go: Test Package` should run the tests in local directory
mode or in package list mode is debatable.
But, we've been using the package list mode for a long time without
complaint. So, this is a regression that needs to be fixed.

Fixes golang/vscode-go#528

Change-Id: Ied06130db1ab6e53b2fb3a3b19ab13b0985fc779
Run-TryBot: Hyang-Ah Hana Kim <>
TryBot-Result: kokoro <>
Reviewed-by: Rebecca Stambler <>
Reviewed-by: Suzy Mueller <>
diff --git a/src/testUtils.ts b/src/testUtils.ts
index 42b5ef4..1fbfc3b 100644
--- a/src/testUtils.ts
+++ b/src/testUtils.ts
@@ -9,6 +9,7 @@
 import { applyCodeCoverageToAllEditors } from './goCover';
 import { toolExecutionEnvironment } from './goEnv';
+import { getCurrentPackage } from './goModules';
 import { GoDocumentSymbolProvider } from './goOutline';
 import { getNonVendorPackages } from './goPackages';
 import {
@@ -303,6 +304,7 @@
 		let pkgMapPromise: Promise<Map<string, string> | null> = Promise.resolve(null);
 		if (testconfig.isMod) {
+			getCurrentPackagePromise = getCurrentPackage(testconfig.dir);
 			// We need the mapping to get absolute paths for the files in the test output.
 			pkgMapPromise = getNonVendorPackages(testconfig.dir, !!testconfig.includeSubDirectories);
 		} else {  // GOPATH mode