IdeaGinkgo / Intellij-Ginkgo

Idea plugin for running and viewing ginkgo tests
GNU General Public License v3.0
33 stars 12 forks source link

Test suite decorators show up as failed tests in IntelliJ's run view with Ginkgo v2 #53

Closed mike-jm closed 1 year ago

mike-jm commented 2 years ago

Steps to reproduce: (You may have to install the ginkgo v2 CLI utility.)

  1. Run the test of the example by clicking the run button on the line containing It("should be able to check out a book")
  2. The test is run and the decorator SynchronizedAfterSuite appears as a failed test in the tree view of IntelliJ's run view
  3. Comment or delete the decorator SynchronizedAfterSuite and run the test again. Now the decorator ReportAfterSuite appears as a failed test in the tree.

Example:

package example

import (
    "github.com/onsi/ginkgo/v2/types"
    "testing"

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

func TestExample(t *testing.T) {
    RegisterFailHandler(Fail)
    RunSpecs(t, "Example Suite")
}

var _ = ReportAfterSuite("Example Suite", func(report types.Report) {
})

var _ = SynchronizedAfterSuite(
    func() {}, func() {
    },
)

var _ = Describe("Books", func() {
    It("should be able to check out a book", func() {
        Expect(true).To(BeTrue())
    })

})
mike-jm commented 2 years ago

Maybe related to this upstream issue https://github.com/onsi/ginkgo/issues/991

TaylorOno commented 2 years ago

What do you think the expected behavior is for these? Should these blocks appear in the test tree but show as passed? or would you expect them not to show up in the test tree at all

mike-jm commented 2 years ago

If it possible to detect broken or buggy decorators it would help to have them in the tree view.

TaylorOno commented 2 years ago

As the current output parser is written I think my only option is to either treat them as tests or ignore them when building the tree view. The current parser is hacky at best. if I get around to rewriting it I could probably support this better