Skip to content

Commit f2074f3

Browse files
authored
fix: log mock (#419)
* fix: log mock * Fix codecov * Optimize codecov * Optimize codecov
1 parent b375b9b commit f2074f3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/codecov.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ jobs:
1515
- name: Install dependencies
1616
run: go mod tidy
1717
- name: Run tests with coverage
18-
run: go test -v -coverprofile="coverage.out" ./...
18+
run: go test -coverprofile="coverage.out" $(go list ./... | grep -v /mocks | grep -v /facades | grep -v /contracts)
19+
- name: Print coverage report
20+
run: go tool cover -func=coverage.out
1921
- name: Upload coverage report to Codecov
2022
uses: codecov/codecov-action@v4
2123
with:

testing/mock/log.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
package mock
22

33
import (
4+
"context"
45
"fmt"
56

67
"github.com/goravel/framework/contracts/http"
78
"github.com/goravel/framework/contracts/log"
89
"github.com/goravel/framework/support/carbon"
910
)
1011

12+
var _ log.Log = &TestLog{}
13+
1114
type TestLog struct {
1215
}
1316

14-
func NewTestLog() log.Writer {
17+
func NewTestLog() log.Log {
1518
return &TestLog{}
1619
}
1720

21+
func (r *TestLog) WithContext(ctx context.Context) log.Writer {
22+
return r
23+
}
24+
1825
func (r *TestLog) Debug(args ...any) {
1926
fmt.Print(prefix("debug"))
2027
fmt.Println(args...)

0 commit comments

Comments
 (0)