Skip to content

Commit 12ca026

Browse files
authored
Merge pull request #4 from go-tstr/codecov
Add codecov
2 parents 9b319b8 + 640a1a9 commit 12ca026

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

.github/workflows/go.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ jobs:
2323
run: go mod download
2424

2525
- name: Test
26-
run: go test ./...
26+
run: go test -coverprofile=coverage.txt ./...
27+
28+
- name: Upload results to Codecov
29+
uses: codecov/codecov-action@v4
30+
with:
31+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage.txt

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# errgroup
2+
3+
[![Go Reference](https://pkg.go.dev/badge/github.com/go-tstr/tstr.svg)](https://pkg.go.dev/github.com/go-tstr/tstr) [![codecov](https://codecov.io/github/go-tstr/tstr/graph/badge.svg?token=H3u7Ui9PfC)](https://codecov.io/github/go-tstr/tstr)
4+
5+
# Better testing with TSTR!

tester.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ type TestingT interface {
2828
Run(name string, fn func(*testing.T)) bool
2929
}
3030

31-
// exit is allows monkey-patching os.Exit in tests.
31+
// exit allows monkey-patching os.Exit in tests.
3232
var exit = os.Exit
3333

3434
// Run runs the test with the given options.
3535
// Options are applied in the order they are passed.
3636
// One of the options must provide the test function.
37+
//
3738
// Options that provide the test function:
38-
// - WithM
39-
// - WithFn
40-
// - WithTable
39+
// - WithM
40+
// - WithFn
41+
// - WithTable
4142
func Run(opts ...Opt) error {
4243
t := NewTester(opts...)
4344
if err := t.Init(); err != nil {
@@ -49,7 +50,8 @@ func Run(opts ...Opt) error {
4950
// RunMain is a convinience wrapper around Run that can be used inside TestMain.
5051
// RunMain applies automatically WithM option which calls m.Run.
5152
// Also os.Exit is called with non-zero exit code if Run returns any error.
52-
// Example TestMain:
53+
//
54+
// Example:
5355
//
5456
// func TestMain(m *testing.M) {
5557
// tstr.RunMain(m, tstr.WithDeps(MyDependency()))

0 commit comments

Comments
 (0)