smartystreets / goconvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
http://smartystreets.github.io/goconvey/
Other
8.23k stars 554 forks source link

go test pass but browser test fails #661

Open yashasolutions opened 2 years ago

yashasolutions commented 2 years ago

Hi,

I am testing a very basic cobra root command,

package cmd

import (
    "github.com/spf13/cobra"
)

func NewRootCmd() *cobra.Command {
    return &cobra.Command{
        Use:   "mycommand",
        Short: "mycommand",
        Long:  "mycommand",
        Run: func(cmd *cobra.Command, args []string) {
            // Do Stuff Here
        },
    }
}
package cmd

import (
    "testing"

    . "github.com/smartystreets/goconvey/convey"
)

func TestRoot(t *testing.T) {
    Convey("Given the root command", t, func() {
        cmd := NewRootCmd()
        Convey("The command should return Nil", func() {
            So(cmd.Execute(), ShouldBeNil)
        })
    })
}

If I run go test it passes.

\>$ go test
.
1 total assertion

PASS
ok      myproject/cmd       0.002s

but in the browser I get:

screen-2022-05-23-02H47-12

Documentation does not state that terminal or browser should be different.

Did I miss something somewhere?