Fixes #241 Use absolute path in output pane to support links#885
Fixes #241 Use absolute path in output pane to support links#885ramya-rao-a merged 3 commits intomicrosoft:masterfrom
Conversation
| let proc = cp.spawn(goRuntimePath, args, { env: testEnvVars, cwd: testconfig.dir }); | ||
| proc.stdout.on('data', chunk => outputChannel.append(chunk.toString())); | ||
| proc.stdout.on('data', chunk => { | ||
| let testOutput = expandFilePathInOutput(chunk.toString(), testconfig.dir); |
There was a problem hiding this comment.
Is there some option for this tool that could make it output absolute paths?
There was a problem hiding this comment.
I don't think there's an option for this, but if it's really needed we could try to add a PR
There was a problem hiding this comment.
I think it requires a proposal to merge such a feature. Have you tried the -exec flag? It allows you to intercept the go test with any program you want. You might be able to access to the test file's absolute path with a custom executable.
A sample exec program: https://github.com/golang/go/blob/master/misc/android/go_android_exec.go
src/goTest.ts
Outdated
| 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(/^\t(\w+_test.go):(\d+):/); |
There was a problem hiding this comment.
You might not want to use \w here because it might not match all characters that are valid in a path, like .. Maybe \S+ (non whitespace char) or just .+ because it's searching between \t and _test already?
There was a problem hiding this comment.
updated to use \S
|
Did you ever know that you're my hero |
Fixes #241
The output from
go test -vin case of test failures look like this:This PR is to expand the filename to its absolute path, so that it is clickable and acts as a link to the test file