Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana authored and onsi committed Mar 18, 2024
1 parent 6e80d3f commit 3a6097a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reporters/default_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

}
Expand Down
17 changes: 17 additions & 0 deletions reporters/default_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ const (
VeryVerbose
FullTrace
ShowNodeEvents
GithubOutput

Parallel //used in the WillRun => DidRun specs to capture behavior when running in parallel
)
Expand Down Expand Up @@ -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, "|")
}

Expand All @@ -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),
}
}

Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 3a6097a

Please sign in to comment.