I am executing the test command as below wherein I need to get coverage of code present in a different folder, say A and executing tests from a different folder, say B. B folder has code that actually calls APIs in folder A. Below is list of commands executed:
go test -p 1 -cover -coverprofile=coverage.out -coverpkg 'some/path/to/pckgroot' ./folder1/file1_test.go ./folder1/file.go go tool cover -html=coverage.out gocovmerge ./coverage*.out > ./coveragefiles.merged go tool cover -html=./coveragefiles.merged
rootFolder |- folderA |- file1.go |- file2.go |- folderB |- file3.go // a main method inside this file calls APIs from file1.go and file2.go |- file3_test.go // go test is called with this file to cover code in folderA
I am getting the report coverage as fine, however, the heat map is not proper, I am using default
set , so it should give whether code is covered or not i.e. either green or red color.
But I am getting shades green gradient color, I don’t want that.
Kindly help me understand where am I missing anything in between, is it the command being used wrong? Please assist.