FYI: I install ginkgo into $HOME/gocode. My .bash_profile
does this:
export GOPATH=$HOME/gocode
export PATH=$PATH:$GOPATH/bin
And I do a custom GOPATH per project. I don't like global GOPATH for all projects. So on projectx, I have to cd projectx && export GOPATH=$(pwd):$GOPATH
for example. It is a minor inconvenience, but I think it is cleaner.
This means, I want to install binaries like ginkgo
into my global GOPATH and not necessarily my project path. Hope that makes sense.
Anyway, ginkgo has a lot of switches and options. Almost everything it does is directory context dependent (remember that).
It looks for suites in a dir to run
cd projectx/src/packagey && ginkgo bootstrap
This will generate a new packagey_test_suite.go
Do this after you create the suite above. For example the file foo.go
ginkgo generate foo
This will generate the file foo_test.go
In the packagey dir
ginkgo
Alternatively, have more verbose output (I use this)
ginkgo -v
Sometimes I add the race detector
ginkgo -v -race
All the same above except you give it the watch
command, e.g.:
ginkgo watch -v
Sometimes you want to watch just your file tests in a loop as you develop:
This assumes you have the following suite named "Foo" in foo_test.go
Describe("Foo", func() {
})
ginkgo watch -v -focus Foo # it matches the name on regex
Step up to the top level dir, of project, for instance and want to run all package tests
gingkgo -R .