Home > OS >  Golang test coverage when test files outside package
Golang test coverage when test files outside package

Time:04-25

I am trying to get the proper coverage amount of my code in the processor package using my test files that are in the test directory. I've tried numerous combinations of -cover and -coverpkg and cannot get it to work correctly. Can this be done while having the test files in separate package/folder?

.
├── internal
│   └── processor
└── test

CodePudding user response:

I tracked down an answer and this is how I was able to accomplish my goal

go test -cover -coverpkg "./internal/processor" "./test"
  • Related