Skip to content

JUnit reporter does not create directory before creating file. #554

@wingyplus

Description

@wingyplus

When call RunSpecsWithCustomReporters with not current directory and it doesn't exist. Ginkgo print an error and stop running:

Failed to create JUnit report file: /tmp/not_exists_folder/junit.xml
	open /tmp/not_exists_folder/junit.xml: no such file or directoryFailed to generate JUnit report
	invalid argumentPASS

Ginkgo ran 1 suite in 930.288973ms
Test Suite Passed

I can produce this issue by this code below:

package main

import (
	"testing"

	"github.com/onsi/ginkgo"
	"github.com/onsi/ginkgo/reporters"
	"github.com/onsi/gomega"
)

func TestSuite(t *testing.T) {
	rpts := []ginkgo.Reporter{
		reporters.NewJUnitReporter("/tmp/not_exists_folder/junit.xml"),
	}

	gomega.RegisterFailHandler(ginkgo.Fail)
	ginkgo.RunSpecsWithCustomReporters(t, "Suite", rpts)
}

var _ = ginkgo.Describe("first", func() {
	ginkgo.It("do something", func() {
	})
})

I have workaround solution by called mkdir before run spec. But I think it would be nice if ginkgo can create directory before create a filename.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Issues that will be resolved by v2

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions