From 601d08717389c394c20aa05dd806466fd9affbf3 Mon Sep 17 00:00:00 2001 From: gedi Date: Sat, 3 Dec 2016 12:12:30 +0200 Subject: [PATCH] adds codecov.io report --- .travis.yml | 9 +++++---- README.md | 1 + suite_test.go | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45da156..4f7ce6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,15 @@ go: - 1.7 - tip +go_import_path: github.com/DATA-DOG/godog + install: go install github.com/DATA-DOG/godog/cmd/godog script: # run standard go tests - go vet ./... - go fmt ./... - - go test -v - - go test -race + - go test -race -coverprofile=coverage.txt -covermode=atomic - # run features - - godog --format=progress --concurrency=4 +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 97682c7..abcf71b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status](https://travis-ci.org/DATA-DOG/godog.svg?branch=master)](https://travis-ci.org/DATA-DOG/godog) [![GoDoc](https://godoc.org/github.com/DATA-DOG/godog?status.svg)](https://godoc.org/github.com/DATA-DOG/godog) +[![codecov.io](https://codecov.io/github/DATA-DOG/godog/branch/master/graph/badge.svg)](https://codecov.io/github/DATA-DOG/godog) # Godog diff --git a/suite_test.go b/suite_test.go index 6c28314..638a0c6 100644 --- a/suite_test.go +++ b/suite_test.go @@ -4,13 +4,30 @@ import ( "bytes" "encoding/json" "fmt" + "os" "path/filepath" "strconv" "strings" + "testing" "github.com/DATA-DOG/godog/gherkin" ) +func TestMain(m *testing.M) { + status := RunWithOptions("godogs", func(s *Suite) { + SuiteContext(s) + }, Options{ + Format: "progress", + Paths: []string{"features"}, + Concurrency: 4, + }) + + if st := m.Run(); st > status { + status = st + } + os.Exit(status) +} + func SuiteContext(s *Suite) { c := &suiteContext{}