Skip to content

Commit

Permalink
[release] src/testUtils.ts: fix parsing of the compiler error file ex…
Browse files Browse the repository at this point in the history
…pansion

Build error output format can be different from the test output format.
Adjust the regex change in expandFilePathInOutput so it can capture
build errors that contain column numbers as well while capturing the
file path from test outputs such as

```
  TestB: b_test.go:6: test failed
```

The above line was incorrectly expanded in pre v0.16.0

pre v0.16.0: /^\s*(.+.go):(\d+):/
v0.16.0, v0.16.1: /\s+(\S+.go):(\d+):\s+/
this CL: /\s*(\S+\.go):(\d+):/

Fixes #522

Change-Id: Ifa8f07d3bb7c5aaa61d40dd29d9fae77d8ad0cbe
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/248737
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
(cherry picked from commit 1e4dbe2)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/252118
TryBot-Result: kokoro <noreply+kokoro@google.com>
  • Loading branch information
hyangah committed Sep 1, 2020
1 parent 354ea27 commit 60a00ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export function cancelRunningTests(): Thenable<boolean> {
function expandFilePathInOutput(output: string, cwd: string): string {
const lines = output.split('\n');
for (let i = 0; i < lines.length; i++) {
const matches = lines[i].match(/\s+(\S+.go):(\d+):\s+/);
const matches = lines[i].match(/\s*(\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 60a00ed

Please sign in to comment.