Skip to content

Commit

Permalink
Added go-unit-tests
Browse files Browse the repository at this point in the history
Added this one which will run all of the unit tests
  • Loading branch information
vallieres committed Oct 24, 2018
1 parent 9826ef0 commit f42d0d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@
files: '\.go$'
language: 'script'
description: "Runs `go-critic`, requires https://github.com/go-critic/go-critic"
- id: go-unit-tests
name: 'go-unit-tests'
entry: run-go-unit-tests.sh
files: '\.go$'
language: 'script'
description: "Runs `go test`"
10 changes: 10 additions & 0 deletions run-go-unit-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
FILES=$(go list ./... | grep -v /vendor/)

go test -tags=unit -timeout 30s -short -v ${FILES}

returncode=$?
if [ $returncode -ne 0 ]; then
echo "unit tests failed"
exit 1
fi

0 comments on commit f42d0d7

Please sign in to comment.