Skip to content
Professional lightweight testing mini-framework for Go.
Go
Branch: master
Clone or download
matryer Merge pull request #31 from sbward/colorful-env
Add IS_NO_COLOR Environment Variable
Latest commit 7fc0834 Sep 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
misc Added failures output Dec 7, 2016
testdata tweaked to make tests pass Feb 15, 2018
.gitignore Initial commit Dec 6, 2016
.travis.yml Added sudo: required to travis file Dec 8, 2016
LICENSE Added new MIT license Jun 12, 2018
README.md Document IS_NO_COLOR in README Aug 29, 2019
is.go IS_NO_COLOR env var Aug 29, 2019
is_test.go Escape comment strings too May 8, 2019

README.md

is GoDoc Go Report Card Build Status

Professional lightweight testing mini-framework for Go.

  • Easy to write and read
  • Beautifully simple API with everything you need: is.Equal, is.True, is.NoErr, and is.Fail
  • Use comments to add descriptions (which show up when tests fail)

Failures are very easy to read:

Examples of failures

Usage

The following code shows a range of useful ways you can use the helper methods:

func Test(t *testing.T) {

	is := is.New(t)
	
	signedin, err := isSignedIn(ctx)
	is.NoErr(err)            // isSignedIn error
	is.Equal(signedin, true) // must be signed in
	
	body := readBody(r)
	is.True(strings.Contains(body, "Hi there"))
	
}

Color

To turn off the colors, run go test with the -nocolor flag, or with the env var IS_NO_COLOR=true.

go test -nocolor
IS_NO_COLOR=true go test
You can’t perform that action at this time.