Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ginkgo_dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ type Benchmarker interface {
//
// ginkgo bootstrap
func RunSpecs(t GinkgoTestingT, description string) bool {
specReporters := []Reporter{buildDefaultReporter()}
var specReporters []Reporter

if config.DefaultReporterConfig.ReportFile != "" {
reportFile := config.DefaultReporterConfig.ReportFile
specReporters[0] = reporters.NewJUnitReporter(reportFile)
return RunSpecsWithDefaultAndCustomReporters(t, description, specReporters)
specReporters = append(specReporters, reporters.NewJUnitReporter(reportFile))
}
return RunSpecsWithCustomReporters(t, description, specReporters)
return RunSpecsWithDefaultAndCustomReporters(t, description, specReporters)
}

//To run your tests with Ginkgo's default reporter and your custom reporter(s), replace
Expand Down
7 changes: 7 additions & 0 deletions reporters/junit_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ func (reporter *JUnitReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) {
if err != nil {
fmt.Printf("\nFailed to create JUnit directory: %s\n\t%s", filePath, err.Error())
}

if config.GinkgoConfig.ParallelTotal > 1 {
ext := filepath.Ext(filePath)
filename := filePath[0:len(filePath)-len(ext)]
filePath = fmt.Sprintf("%s_%02d%s", filename, config.GinkgoConfig.ParallelNode, ext)
}

file, err := os.Create(filePath)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create JUnit report file: %s\n\t%s", filePath, err.Error())
Expand Down