Skip to content

Commit

Permalink
chore: improve error message for finding reports
Browse files Browse the repository at this point in the history
also runs `make lint`
  • Loading branch information
joseph-sentry committed Mar 8, 2024
1 parent ced5094 commit 666f50a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions codecov_cli/services/upload/upload_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ def generate_upload_data(self, report_type="coverage") -> UploadCollectionResult
files = self.file_finder.find_files()
logger.info(f"Found {len(files)} {report_type} files to upload")
if not files:
if report_type == "test_results":
error_message = "No JUnit XML reports found. Please review our documentation (https://docs.codecov.com/docs/test-result-ingestion-beta) to generate and upload the file."

Check warning on line 157 in codecov_cli/services/upload/upload_collector.py

View check run for this annotation

Codecov / codecov/patch

codecov_cli/services/upload/upload_collector.py#L156-L157

Added lines #L156 - L157 were not covered by tests
else:
error_message = "No coverage reports found. Please make sure you're generating reports successfully."

Check warning on line 159 in codecov_cli/services/upload/upload_collector.py

View check run for this annotation

Codecov / codecov/patch

codecov_cli/services/upload/upload_collector.py#L159

Added line #L159 was not covered by tests
raise click.ClickException(
click.style(
f"No {report_type} reports found. Please make sure you're generating reports successfully.",
error_message,
fg="red",
)
)
Expand All @@ -164,7 +168,9 @@ def generate_upload_data(self, report_type="coverage") -> UploadCollectionResult
return UploadCollectionResult(
network=network,
files=files,
file_fixes=self._produce_file_fixes_for_network(network)
if report_type == "coverage"
else [],
file_fixes=(
self._produce_file_fixes_for_network(network)
if report_type == "coverage"
else []
),
)

0 comments on commit 666f50a

Please sign in to comment.