We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows skipping of tests with specific names
func RunWithSkip(t *testing.T, newHandler func(*testing.T) slog.Handler, result func(*testing.T) map[string]any, skipTestName ...string)
Several logging libraries trying to support log/slog, but seem to not much imported testing/slogtest
log/slog
testing/slogtest
This is just a guess based on my personal insight:
Add RunWithSkip, allows skipping of tests with specific test names.
RunWithSkip
The text was updated successfully, but these errors were encountered:
CC @jba
Sorry, something went wrong.
If could not skip the test, Future additions of slogtest cases that support edge cases, it might break the GHA pipeline and block Golang updates.
I think you can do what you want with the existing slogtest.Run function:
slogtest.Run
slogtest.Run(t, func(t *testing.T) slog.Handler { if skipNameMap[t.Name()] { t.Skip() } ..., }, ...)
Please correct me if I've misunderstood.
you are right, This proposal is retractable.
https://go.dev/play/p/nJY0XtnW6mz
newHandler := func(tt *testing.T) slog.Handler { if slices.Contains([]string{"TestSlogtest/empty-attr", "TestSlogtest/inline-group", "TestSlogtest/empty-group-record"}, tt.Name()) { tt.Skip("skipped.") } buff.Reset() return zapslog.NewHandler(core, nil) } run := func(tt *testing.T) map[string]any { var ent map[string]any if err := json.Unmarshal(buff.Bytes(), &ent); err != nil { t.Fatal(err) } return ent } slogtest.Run(t, newHandler, tf)
No branches or pull requests
Proposal Summary
Allows skipping of tests with specific names
Problems
Several logging libraries trying to support
log/slog
, but seem to not much importedtesting/slogtest
Background
This is just a guess based on my personal insight:
Proposal
Add
RunWithSkip
, allows skipping of tests with specific test names.Benefits
The text was updated successfully, but these errors were encountered: