Skip to content

Commit

Permalink
fix: Skip rendering JUnit&JSON reporters when running in async mode (#…
Browse files Browse the repository at this point in the history
…810)

* fix: Skip downloading reporters when running in async mode

* refine a bit

* fix bug

* revert changes
  • Loading branch information
tianfeng92 authored Jul 20, 2023
1 parent cbea780 commit 2f2a66b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/run/cucumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func runCucumber(cmd *cobra.Command, isCLIDriven bool) (int, error) {
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"cucumber", "sauce"),
"cucumber", "sauce", gFlags.async),
Async: gFlags.async,
FailFast: gFlags.failFast,
MetadataSearchStrategy: framework.NewSearchStrategy(p.Playwright.Version, p.RootDir),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/cypress.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func runCypress(cmd *cobra.Command, isCLIDriven bool) (int, error) {
Region: regio,
ShowConsoleLog: p.IsShowConsoleLog(),
Reporters: createReporters(p.GetReporter(), p.GetNotifications(), p.GetSauceCfg().Metadata, &testcompClient, &restoClient,
"cypress", "sauce"),
"cypress", "sauce", gFlags.async),
Async: gFlags.async,
FailFast: gFlags.failFast,
MetadataSearchStrategy: framework.NewSearchStrategy(p.GetVersion(), p.GetRootDir()),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/espresso.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func runEspressoInCloud(p espresso.Project, regio region.Region) (int, error) {
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"espresso", "sauce"),
"espresso", "sauce", gFlags.async),
Framework: framework.Framework{Name: espresso.Kind},
Async: gFlags.async,
FailFast: gFlags.failFast,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/playwright.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func runPlaywright(cmd *cobra.Command, isCLIDriven bool) (int, error) {
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"playwright", "sauce"),
"playwright", "sauce", gFlags.async),
Async: gFlags.async,
FailFast: gFlags.failFast,
MetadataSearchStrategy: framework.NewSearchStrategy(p.Playwright.Version, p.RootDir),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func runPuppeteerReplayInSauce(p replay.Project, regio region.Region) (int, erro
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"puppeteer-replay", "sauce"),
"puppeteer-replay", "sauce", gFlags.async),
Async: gFlags.async,
FailFast: gFlags.failFast,
MetadataSearchStrategy: framework.ExactStrategy{},
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func checkForUpdates() {
}

func createReporters(c config.Reporters, ntfs config.Notifications, metadata config.Metadata,
svc slack.Service, buildReader build.Reader, framework, env string) []report.Reporter {
svc slack.Service, buildReader build.Reader, framework, env string, async bool) []report.Reporter {
buildReporter := buildtable.New(buildReader)
githubReporter := github.NewJobSummaryReporter()

Expand All @@ -292,13 +292,13 @@ func createReporters(c config.Reporters, ntfs config.Notifications, metadata con
&githubReporter,
}

if c.JUnit.Enabled {
if !async && c.JUnit.Enabled {
reps = append(reps, &junit.Reporter{
Filename: c.JUnit.Filename,
})
}

if c.JSON.Enabled {
if !async && c.JSON.Enabled {
reps = append(reps, &json.Reporter{
WebhookURL: c.JSON.WebhookURL,
Filename: c.JSON.Filename,
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/testcafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func runTestcafe(cmd *cobra.Command, tcFlags testcafeFlags, isCLIDriven bool) (i
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"testcafe", "sauce"),
"testcafe", "sauce", gFlags.async),
Async: gFlags.async,
FailFast: gFlags.failFast,
MetadataSearchStrategy: framework.NewSearchStrategy(p.Testcafe.Version, p.RootDir),
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/xcuitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func runXcuitestInCloud(p xcuitest.Project, regio region.Region) (int, error) {
Region: regio,
ShowConsoleLog: p.ShowConsoleLog,
Reporters: createReporters(p.Reporters, p.Notifications, p.Sauce.Metadata, &testcompClient, &restoClient,
"xcuitest", "sauce"),
"xcuitest", "sauce", gFlags.async),
Framework: framework.Framework{Name: xcuitest.Kind},
Async: gFlags.async,
FailFast: gFlags.failFast,
Expand Down

0 comments on commit 2f2a66b

Please sign in to comment.