Skip to content

Commit

Permalink
chore: Use testify to shorten tests and replace glide with dep
Browse files Browse the repository at this point in the history
  • Loading branch information
aseure committed Jun 19, 2018
1 parent 0e6f4c4 commit 32bd096
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go:

before_install:
- mkdir -p /home/travis/gopath/{src,bin,pkg}
- curl https://glide.sh/get | sh
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- go get -u github.com/rakyll/gotest

install:
Expand Down
28 changes: 28 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/stretchr/testify"
version = "~1.1.4"

[prune]
go-tests = true
unused-packages = true
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
PROJECT=algoliasearch
COVERAGE_FILE=coverage.out

install:
go install ./$(PROJECT)

deps:
glide install
dep ensure -vendor-only

test: test-unit

test-unit:
test:
gotest -v ./$(PROJECT)

coverage:
go list -f '{{if gt (len .TestGoFiles) 0}}"go test -covermode count -coverprofile {{.Name}}.coverprofile -coverpkg ./... {{.ImportPath}}"{{end}}' ./... | xargs -I {} bash -c {}
gocovmerge `ls *.coverprofile` > $(COVERAGE_FILE)
go tool cover -html=$(COVERAGE_FILE)

.PHONY: install test clean
.PHONY: install deps test

0 comments on commit 32bd096

Please sign in to comment.