Skip to content

Add junit config option for omitting leafnodetype#1088

Merged
onsi merged 1 commit into
onsi:masterfrom
jbpratt:junit-config-omit-leafnodetype
Dec 8, 2022
Merged

Add junit config option for omitting leafnodetype#1088
onsi merged 1 commit into
onsi:masterfrom
jbpratt:junit-config-omit-leafnodetype

Conversation

@jbpratt

@jbpratt jbpratt commented Dec 6, 2022

Copy link
Copy Markdown
Contributor

similarly to de44005, users may also want to omit the LeafNodeType

allow omitting the LeafNodeType ([It]) from being included in the
junit results file by adding a new config option and skipping over the
setting of name to LeafNodeType. Default behavior remains as is.

Signed-off-by: Brady Pratt bpratt@redhat.com

package ginkgo

import (
    "testing"

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

func TestPR(t *testing.T) {
    ReportAfterSuite("Test PR", func(report Report) {
        reporters.GenerateJUnitReportWithConfig(
            report,
            "test.xml",
            reporters.JunitReportConfig{OmitLeafNodeType: true},
        )
    })

    RegisterFailHandler(Fail)
    RunSpecs(t, "Test PR", Label("pr-test"))
}

var _ = Describe("String comparison", func() {
    It("should be equal", Label("pr-test"), func() {
        Expect("apple").To(Equal("apple"))
    })
})
❯ cat test.xml | grep testcase
          <testcase name="String comparison should be equal [pr-test]" classname="Test PR" status="skipped" time="0">
          </testcase>

@jbpratt jbpratt force-pushed the junit-config-omit-leafnodetype branch 2 times, most recently from 2ba055e to 88b878f Compare December 7, 2022 20:33
allow omitting the LeafNodeType (`[It]`) from being included in the
junit results file by adding a new config option and skipping over the
setting of name to LeafNodeType. Default behavior remains as is.

a follow up on de44005

Signed-off-by: Brady Pratt <bpratt@redhat.com>
@onsi onsi merged commit 956e6d2 into onsi:master Dec 8, 2022
@onsi

onsi commented Dec 8, 2022

Copy link
Copy Markdown
Owner

looks good now - thanks!

@jbpratt jbpratt deleted the junit-config-omit-leafnodetype branch December 8, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants