Skip to content

Commit

Permalink
Merge pull request #47 from goodhosts/coverage
Browse files Browse the repository at this point in the history
adding coverage mage helpers
  • Loading branch information
luthermonson authored Oct 15, 2023
2 parents 9d1b748 + af17bc4 commit 39225b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea
coverate.txt
coverage.txt
213 changes: 0 additions & 213 deletions coverage.txt

This file was deleted.

16 changes: 16 additions & 0 deletions mage/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ func Coverage() error {
fmt.Println("Running Tests with Coverage...")
return sh.RunV("go", "test", "-v", "-coverprofile=coverage.txt", ".")
}

// HTML display the html coverage report from the cover tool
func HTML() error {
if err := Coverage(); err != nil {
return err
}
return sh.RunV("go", "tool", "cover", "-html", "coverage.txt")
}

// Func display the func coverage report from the cover tool
func Func() error {
if err := Coverage(); err != nil {
return err
}
return sh.RunV("go", "tool", "cover", "-func", "coverage.txt")
}

0 comments on commit 39225b3

Please sign in to comment.