go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.56k stars 571 forks source link

Ginkgo suport #682

Open rnapier opened 10 years ago

rnapier commented 10 years ago

Ginkgo tests do not appear in the test browser, and failures show up as success. Even though the output ends with:

...
Ran 30 of 37 Specs in 0.047 seconds
FAIL! -- 23 Passed | 7 Failed | 7 Pending | 0 Skipped --- FAIL: TestClient (0.05 seconds)
FAIL
exit status 1
FAIL    client  0.669s

the test browser shows a green "OK". This was run as:

/usr/local/Cellar/go/1.2.1/libexec/bin/go test -v ./... -ginkgo.noColor

(it's possible there is a deeper test runner problem here, since it should detect success/failure in any case.)

If it is helpful, Ginkgo will spit out a junit.xml file, which might be easier to handle than its own output.

IDEA: 13.1 CE OS: OS X 10.9 (also Win7) JDK: 1.6.0

gabrielf commented 8 years ago

Using IntelliJ 15 and Goplugin 0.10.1137 I can run Ginkgo-tests using the Go-plugin out of the box using ctrl+shift+r provided I have the snippet bridging go test and ginkgo in the file:

func TestGinkgo(t *testing.T) {
    RegisterFailHandler(Fail)
    RunSpecs(t, "Some Test Suite Name")
}

Complete Ginkgo-test:

package main_test

import (
    . "github.com/onsi/ginkgo"
    . "github.com/onsi/gomega"

    "testing"
)

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

var _ = Describe("Running tests with Ginkgo", func() {
    It("can succeed", func() {
        Expect(true).To(BeTrue())
    })
    It("can fail", func() {
        Expect(false).To(BeTrue())
    })
})

Running the test looks like this:

image

However there are some limitations: