Align output with `go test` to facilitate integration with editors
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- developer-experience, testing-qa
Research direction
Start by comparing testify's failure output with the standard library's go test format and review the error messages produced through Fail. Use the vim-go regex and the examples in the issue as acceptance criteria; done means failures emit a single-line file:line summary without requiring a flag or environment variable.
Written by the indexing model from the issue text.
Description
From PR #254:
Best thing to do to facilitate integration into tools like vim-go would be to align with the output from go test. Stdlib prints a single line per error as file.go:line: message.
As an example, vim-go has the following regex: let tokens = matchlist(line, '^\s*\(.\{-}\):\(\d\+\):\s*\(.*\)'). They have some logic to figure out the path of the file.
In order to align with go test and get our errors picked up by vim-go we need to output a single line of text matching the regex and showing a one-line summary.
e.g:
--- FAIL: TestExample (0.00s)
main_test.go:18: values should be equal
Error Trace: main_test.go:18
Error: Not equal: []string{"a", "b", "x"} (expected)
!= []string{"a", "b", "y", "d"} (actual)
Diff:
--- Expected
+++ Actual
@@ -1,5 +1,6 @@
-([]string) (len=3 cap=3) {
+([]string) (len=4 cap=4) {
(string) (len=1) "a",
(string) (len=1) "b",
- (string) (len=1) "x"
+ (string) (len=1) "y",
+ (string) (len=1) "d"
}
However this would require reviewing all the error messages from testify and might require a breaking to include the one-liner error argument in Fail.
In any case, it's better to avoid adding the path. Plugins would already have logic to figure out the path based on the stdlib output. Adding the path can pollute the output considerably and make it less readable.
Furthermore, if we were to do it, I believe we should have it enabled by default rather than hiding it behind a flag or an env variable. That way it'll be integrated by the tool's default go test execution rather than require special configuration to have testify place nicely with editor plugins.
- Dominant language
- Go
- Stars
- 26.2k
- Forks
- 1.9k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stretchr/testify
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
internal/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in stretchr/testify
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100