Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Expand file paths only when test fails #1836
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Mar 26, 2020
1 parent 79a6b01 commit 893b29b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,18 +328,19 @@ export async function goTest(testconfig: TestConfig): Promise<boolean> {
const testResultLines: string[] = [];

const processTestResultLine = (line: string) => {
if (!testconfig.includeSubDirectories) {
outputChannel.appendLine(expandFilePathInOutput(line, testconfig.dir));
return;
}
testResultLines.push(line);
const result = line.match(packageResultLineRE);
if (result && (pkgMap.has(result[2]) || currentGoWorkspace)) {
const hasTestFailed = line.startsWith('FAIL');
const packageNameArr = result[2].split('/');
const baseDir = pkgMap.get(result[2]) || path.join(currentGoWorkspace, ...packageNameArr);
testResultLines.forEach((testResultLine) =>
outputChannel.appendLine(expandFilePathInOutput(testResultLine, baseDir))
);
testResultLines.forEach((testResultLine) => {
if (hasTestFailed) {
outputChannel.appendLine(expandFilePathInOutput(testResultLine, baseDir));
} else {
outputChannel.appendLine(testResultLine);
}
});
testResultLines.splice(0);
}
};
Expand Down

0 comments on commit 893b29b

Please sign in to comment.