diff --git a/src/goModules.ts b/src/goModules.ts index ed11c1b50d..87f50f566f 100644 --- a/src/goModules.ts +++ b/src/goModules.ts @@ -29,7 +29,7 @@ async function runGoModEnv(folderPath: string): Promise { cp.execFile(goExecutable, ['env', 'GOMOD'], { cwd: folderPath, env }, (err, stdout) => { if (err) { console.warn(`Error when running go env GOMOD: ${err}`); - return resolve(); + return resolve(''); } const [goMod] = stdout.split('\n'); resolve(goMod); @@ -179,7 +179,7 @@ export async function getCurrentPackage(cwd: string): Promise { .split('\n') .filter((line) => line && line.indexOf(' ') === -1); if (pkgs.length !== 1) { - resolve(); + resolve(''); return; } folderToPackageMapping[cwd] = pkgs[0]; diff --git a/src/goTest.ts b/src/goTest.ts index 5b1576d129..89ec4ad474 100644 --- a/src/goTest.ts +++ b/src/goTest.ts @@ -241,13 +241,11 @@ export function testWorkspace(goConfig: vscode.WorkspaceConfiguration, args: any vscode.window.showInformationMessage('No workspace is open to run tests.'); return; } - let workspaceUriIsDir = true; let workspaceUri = vscode.workspace.workspaceFolders[0].uri; if ( vscode.window.activeTextEditor && vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri) ) { - workspaceUriIsDir = false; workspaceUri = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri; } @@ -260,7 +258,7 @@ export function testWorkspace(goConfig: vscode.WorkspaceConfiguration, args: any // Remember this config as the last executed test. lastTestConfig = testConfig; - isModSupported(workspaceUri, workspaceUriIsDir).then((isMod) => { + isModSupported(workspaceUri, true).then((isMod) => { testConfig.isMod = isMod; goTest(testConfig).then(null, (err) => { console.error(err); diff --git a/src/testUtils.ts b/src/testUtils.ts index 74fc1ae902..9c8a31129c 100644 --- a/src/testUtils.ts +++ b/src/testUtils.ts @@ -452,8 +452,8 @@ function processTestResultLineInStandardMode( currentGoWorkspace: string, testResultLines: string[], outputChannel: vscode.OutputChannel) { - // 1=ok/FAIL, 2=package, 3=time/(cached) - const packageResultLineRE = /^(ok|FAIL)\s+(\S+)\s+([0-9\.]+s|\(cached\))/; + // 1=ok/FAIL/?, 2=package, 3=time/(cached)/[no test files] + const packageResultLineRE = /^(ok|FAIL|\?)\s+(\S+)\s+([0-9\.]+s|\(cached\)|\[no test files\])/; const lineWithErrorRE = /^(\t|\s\s\s\s)\S/; return (line: string) => {