Comments (6)
I can't reproduce this behaviour, using go test -v -coverprofile=coverage.txt -covermode count
I get coverage information in coverage.txt.
What does go env
show for you and what version of testify are you using?
from testify.
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/m.kuznetsov/Library/Caches/go-build'
GOENV='/Users/m.kuznetsov/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/m.kuznetsov/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/m.kuznetsov/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.6/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.6/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/0b/1yz4ln6s3_9dlxnk8qxyg5d81c7vwk/T/go-build2343961692=/tmp/go-build -gno-record-gcc-switches -fno-common'
But in CI/CD it doesn't work too. I use GitlabCI and image golang:1.21-bookworm
from testify.
What testify version are you using?
Using (mostly) your code example with go 1.21.6 on darwin/arm64 I get coverage:
% go version
go version go1.21.6 darwin/arm64
% go test -v -coverprofile=coverage.txt -covermode count
=== RUN TestRun
=== RUN TestRun/TestSuite1
--- PASS: TestRun (0.00s)
--- PASS: TestRun/TestSuite1 (0.00s)
PASS
coverage: 100.0% of statements
ok github.com/brackendawson/kata 0.593s
% cat coverage.txt
mode: count
github.com/brackendawson/kata/kata.go:3.21,5.2 1 1
Does your code actually have any statements?
from testify.
github.com/stretchr/testify v1.8.4 (last version)
>go version
go version go1.21.6 darwin/arm64
>go test -v -coverprofile=coverage.txt -covermode count
=== RUN TestRun
=== RUN TestRun/TestISuite1
--- PASS: TestRun (0.05s)
--- PASS: TestRun/TestISuite1 (0.00s)
PASS
coverage: [no statements]
ok mytests/tests 0.586s
>cat coverage.txt
mode: count
Does your code actually have any statements?
Yes, I have code which work with DB. But I tried to write "test code" and find the problem. I got the same empty coverage.
from testify.
Can you share a compilable recreate?
from testify.
Please comment, or start a discussion (tab up top), if you still have this issue.
from testify.
Related Issues (20)
- Assert: go test output shows subtests that fail as PASS HOT 3
- `YAMLEq` does not validate YAML HOT 1
- Is it possible to assert for multiple allowed values? HOT 2
- Proposal: guard or support comparing with untyped nil HOT 5
- assert/require.Len doesn't print anything if the slice is too long HOT 7
- Allow user to skip (ignore) specific caller frames in assert.CallerInfo() HOT 1
- Unexpected call when interface is parameter HOT 4
- Fix CVE-2022-28948 - Remove `gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c` HOT 3
- assert: Equal does not consider Zone information in time.Time
- Update Github actions workflows from nodejs 16 to nodejs 20 before "Spring 2024" HOT 1
- mock: Call.NotBefore still expects calls removed with Call.Unset HOT 6
- unnecessary/incorrect log call in AssertExpectations HOT 2
- Data race when mock is called with refernce to same object as expectation HOT 1
- assert fails and expects to dereference a reference HOT 1
- Add GoLang 1.22 to CI Testing Matrix for Package Compatibility Verification HOT 2
- error while importing github.com/stretchr/testify/suite: read C:\Program Files\Go\src\math\huge_test.go: unexpected NUL in input HOT 1
- AnythingOfType is marked deprecated on pkgsite HOT 1
- .On().Return() doesn't enforce expectation for the returned value HOT 1
- v1.9.0 breaks float comparisons with EqualValues HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testify.