Merge pull request #11157 from afbjorklund/test-report-html

test: Add target for the test report as html
pull/11003/head
Medya Ghazizadeh 2021-04-20 14:22:19 -07:00 committed by GitHub
commit 6faf2411fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

2
.gitignore vendored
View File

@ -22,8 +22,6 @@ _cgo_export.*
_testmain.go
coverage.html
*.exe
*.test
*.prof

View File

@ -368,14 +368,19 @@ gotest: $(SOURCE_GENERATED) ## Trigger minikube test
$(Q)go test -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" $(MINIKUBE_TEST_FILES)
# Run the gotest, while recording JSON report and coverage
out/test-report.json: $(SOURCE_FILES) $(GOTEST_FILES)
out/unittest.json: $(SOURCE_FILES) $(GOTEST_FILES)
$(if $(quiet),@echo " TEST $@")
$(Q)go test -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS)" $(MINIKUBE_TEST_FILES) \
-coverprofile=out/coverage.out -json > out/test-report.json
out/coverage.out: out/test-report.json
-coverprofile=out/coverage.out -json > out/unittest.json
out/coverage.out: out/unittest.json
# Generate go test report (from gotest) as a a HTML page
out/unittest.html: out/unittest.json
$(if $(quiet),@echo " REPORT $@")
$(Q)go-test-report < $< -o $@
# Generate go coverage report (from gotest) as a HTML page
coverage.html: out/coverage.out
out/coverage.html: out/coverage.out
$(if $(quiet),@echo " COVER $@")
$(Q)go tool cover -html=$< -o $@

View File

@ -7,5 +7,5 @@ sonar.exclusions=**/*_test.go,pkg/minikube/assets/assets.go,pkg/minikube/transla
sonar.tests=cmd,pkg
sonar.test.inclusions=**/*_test.go
sonar.go.tests.reportPaths=out/test-report.json
sonar.go.tests.reportPaths=out/unittest.json
sonar.go.coverage.reportPaths=out/coverage.out