I think I’m encountering a bug. I tried working around this for a while now but it seems its not possible.
I am using a go monorepo with multiple microservices (and several languages). I setup exclude and test patterns:
exclude_patterns = [ "**/*.js", "**/*.sql.go", "**/*.gen.*", "**/node_modules/**", "build/**", "dist/**", "e2e/**", "gen/**", "node_modules/**", "shared/go/testutils/*.go", ] test_patterns = [ "**/*_test.go", "**/__mocks__/**", "**/main.go", "**/mocks.*", "**/mocks/**", "**/tests/**", "**/vitest.*", "vitest.*", ]
This works to exclude all the generated code and test utilities. Note - i excluded them completely, but I also tried using the
test_patterns for them with similar results.
Whats happening? This allowed me to narrow down the coverage issues reported only to the files i wanted covered, and fix all the coverage issues. I now have exactly zero coverage issues related to go, and running the go CLI test command shows I have 100% coverage for all the files that I want covered.
BUT - the reports in deepsource are stuck around 80% coverage. It seems that deepsource still factors in the excluded code when calculating the coverage. This makes the use of the quality gates impossible really.