Code Monkey home page Code Monkey logo

Comments (6)

brackendawson avatar brackendawson commented on June 11, 2024

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.

mkuznetsov2 avatar mkuznetsov2 commented on June 11, 2024
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.

brackendawson avatar brackendawson commented on June 11, 2024

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.

mkuznetsov2 avatar mkuznetsov2 commented on June 11, 2024

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.

brackendawson avatar brackendawson commented on June 11, 2024

Can you share a compilable recreate?

from testify.

brackendawson avatar brackendawson commented on June 11, 2024

Please comment, or start a discussion (tab up top), if you still have this issue.

from testify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.