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

Commit

Permalink
Make filepaths clickable on test error output Fixes #1562
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Mar 15, 2018
1 parent 64104a1 commit 2e56cbf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export function goTest(testconfig: TestConfig): Thenable<boolean> {
outBuf.onLine(line => outputChannel.appendLine(expandFilePathInOutput(line, testconfig.dir)));
outBuf.onDone(last => last && outputChannel.appendLine(expandFilePathInOutput(last, testconfig.dir)));

errBuf.onLine(line => outputChannel.appendLine(line));
errBuf.onDone(last => last && outputChannel.appendLine(last));
errBuf.onLine(line => outputChannel.appendLine(expandFilePathInOutput(line, testconfig.dir)));
errBuf.onDone(last => last && outputChannel.appendLine(expandFilePathInOutput(last, testconfig.dir)));

proc.stdout.on('data', chunk => outBuf.append(chunk.toString()));
proc.stderr.on('data', chunk => errBuf.append(chunk.toString()));
Expand Down Expand Up @@ -204,8 +204,8 @@ export function showTestOutput() {
function expandFilePathInOutput(output: string, cwd: string): string {
let lines = output.split('\n');
for (let i = 0; i < lines.length; i++) {
let matches = lines[i].match(/^\s+(\S+_test.go):(\d+):/);
if (matches) {
let matches = lines[i].match(/^\s*(.+.go):(\d+):/);
if (matches && matches[1] && !path.isAbsolute(matches[1])) {
lines[i] = lines[i].replace(matches[1], path.join(cwd, matches[1]));
}
}
Expand Down

0 comments on commit 2e56cbf

Please # to comment.