From 3a6097aafcdf510313435ab9d2c04cc1cde8891d Mon Sep 17 00:00:00 2001 From: Charly Molter Date: Wed, 13 Mar 2024 21:08:04 +0100 Subject: [PATCH] add test Signed-off-by: Charly Molter --- reporters/default_reporter.go | 4 ++-- reporters/default_reporter_test.go | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/reporters/default_reporter.go b/reporters/default_reporter.go index bfd8b892c..4026859ec 100644 --- a/reporters/default_reporter.go +++ b/reporters/default_reporter.go @@ -187,13 +187,13 @@ func (r *DefaultReporter) wrapTextBlock(sectionName string, fn func()) { if r.conf.GithubOutput { r.emitBlock(r.fi(1, "::group::%s", sectionName)) } else { - r.emitBlock(r.fi(1, "{{gray}}<< %s{{/}}", sectionName)) + r.emitBlock(r.fi(1, "{{gray}}%s >>{{/}}", sectionName)) } fn() if r.conf.GithubOutput { r.emitBlock(r.fi(1, "::endgroup::")) } else { - r.emitBlock(r.fi(1, "{{gray}}%s >>{{/}}", sectionName)) + r.emitBlock(r.fi(1, "{{gray}}<< %s{{/}}", sectionName)) } } diff --git a/reporters/default_reporter_test.go b/reporters/default_reporter_test.go index 27d357159..b9a46612c 100644 --- a/reporters/default_reporter_test.go +++ b/reporters/default_reporter_test.go @@ -176,6 +176,7 @@ const ( VeryVerbose FullTrace ShowNodeEvents + GithubOutput Parallel //used in the WillRun => DidRun specs to capture behavior when running in parallel ) @@ -204,6 +205,9 @@ func (cf ConfigFlag) String() string { if cf.Has(Parallel) { out = append(out, "parallel") } + if cf.Has(GithubOutput) { + out = append(out, "github-output") + } return strings.Join(out, "|") } @@ -226,6 +230,7 @@ func C(flags ...ConfigFlag) types.ReporterConfig { VeryVerbose: f.Has(VeryVerbose), FullTrace: f.Has(FullTrace), ShowNodeEvents: f.Has(ShowNodeEvents), + GithubOutput: f.Has(GithubOutput), } } @@ -770,6 +775,18 @@ var _ = Describe("DefaultReporter", func() { " {{gray}}<< Captured StdOut/StdErr Output{{/}}", DELIMITER, ""), + Case(Parallel|GithubOutput, + DELIMITER, + spr("{{green}}%s [1.000 seconds]{{/}}", DENOTER), + "{{green}}{{bold}}A{{/}}", + "{{gray}}cl0.go:12{{/}}", + "", + " ::group::Captured StdOut/StdErr Output", + " hello there", + " this is my output", + " ::endgroup::", + DELIMITER, + ""), ), Entry("a passing test with a full timeline that is only visible in verbose/very-verbose mode", S(types.NodeTypeIt, "A", cl0, GW("some GinkgoWriter\noutput is interspersed\nhere and there\n"),