diff --git a/gatorgrade/output/output.py b/gatorgrade/output/output.py index d8458a83..cc13c411 100644 --- a/gatorgrade/output/output.py +++ b/gatorgrade/output/output.py @@ -105,6 +105,8 @@ def create_report_json( # grab all of the information in it and add it to the checks list results_json = checkResults[i].json_info results_json["status"] = checkResults[i].passed + if not checkResults[i].passed: + results_json["diagnostic"] = checkResults[i].diagnostic checks_list.append(results_json) # create the dictionary for all of the check information @@ -179,6 +181,8 @@ def create_markdown_report_file(json: dict) -> str: elif "command" in check: val = check["command"] markdown_contents += f"\n\t- **command:** {val}" + if 'diagnostic' in check: + markdown_contents += f"\n\t- **diagnostic:** {check['diagnostic']}" markdown_contents += "\n" return markdown_contents diff --git a/tests/output/test_output.py b/tests/output/test_output.py index 2b7e240b..325068ea 100644 --- a/tests/output/test_output.py +++ b/tests/output/test_output.py @@ -246,6 +246,7 @@ def test_json_report_file_created_correctly(): "File": "hello-world.py", }, "status": False, + "diagnostic": "Found 0 fragment(s) in the hello-world.py or the output while expecting exactly 1", }, { "description": 'Invalid GatorGrader check: "--description Call the "greet" function in hello - world.py MatchFileFragment--fragment greet(--count 2 E--directory tests / test_assignment / src--file hello - world.py\ ', @@ -256,6 +257,7 @@ def test_json_report_file_created_correctly(): "File": "hello-world.py", }, "status": False, + "diagnostic":"\"\" thrown by GatorGrader", }, ], }