We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when running bazel coverage on this code i get 0 lines covered in the report types.go
func WithReadOnly(readOnly bool) DataSourceOption { return func(d *DataSourceRequest) *DataSourceRequest { d.ReadOnly = readOnly return d } }
types_test.go
func TestWithReadOnly(t *testing.T) { tests := []struct { name string readOnly bool }{ {"Set readOnly to true", true}, {"Set readOnly to false", false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ds := &DataSourceRequest{} option := WithReadOnly(tt.readOnly) option(ds) assert.Equal(t, tt.readOnly, ds.ReadOnly) }) } }
but running go test -coverprofile=output ./... returns the correct amount of covered lines. Im running coverage with the following config
coverage --experimental_split_coverage_postprocessing coverage --experimental_fetch_all_coverage_outputs coverage --combined_report=lcov coverage --nocache_test_results
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered:
Bazel excludes coverage of test code by default. Could you try --instrument_test_targets?
--instrument_test_targets
Sorry, something went wrong.
@fmeum ur answer fixed my issue but now my coverage report is full of _test.go files.
Let me be more specific the code is in two files: in types.go and the test (TestWithReadOnly) is in types_test.go
It'd espect types.go to have 100% coverage without having to instrument types_test.go
Could you share a self-contained reproducer? That would make it easier to understand your target structure and experiment with different settings.
No branches or pull requests
when running bazel coverage on this code i get 0 lines covered in the report
types.go
types_test.go
but running go test -coverprofile=output ./... returns the correct amount of covered lines.
Im running coverage with the following config
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered: