-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdoc.go
50 lines (34 loc) · 1.82 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
A recursive coverage testing tool.
roveralls runs coverage tests on a package and all its sub-packages. The coverage profile is output as a single file called 'roveralls.coverprofile' for use by tools such as goveralls.
This tool was inspired by https://github.com/go-playground/overalls written by Dean Karn, but I found it difficult to test and brittle so I decided to rewrite it from scratch. Thanks for the inspiration Dean.
Usage
At its simplest, to test the current package and sub-packages and create a 'roveralls.coverprofile' file in the directory that you run the command:
roveralls
To see the help for the command:
roveralls -help
roveralls runs coverage tests on a package and all its sub-packages. The
coverage profile is output as a single file called 'roveralls.coverprofile'
for use by tools such as goveralls.
Usage of roveralls:
-covermode count,set,atomic
Mode to run when testing files: count,set,atomic (default "count")
-help
Display this help
-ignore dir1,dir2,...
Comma separated list of directory names to ignore: dir1,dir2,... (default ".git,vendor")
-short
Tell long-running tests to shorten their run time
-v Verbose output
View Output in a Web Browser
To view the code coverage for you package in a browser:
go tool cover -html=roveralls.coverprofile
Use with goveralls
The output of roveralls is the same as the the standard:
go test -coverprofile=profile.coverprofile
but with multiple files tested in the output file. This can therefore be used with tools such as goveralls.
If you wanted to call it from a '.travis.yml' script you could use:
- $HOME/gopath/bin/roveralls
- $HOME/gopath/bin/goveralls -coverprofile=roveralls.coverprofile -service=travis-ci
*/
package main