Skip to content

Commit

Permalink
Feat: add diagnostic message in js and md output
Browse files Browse the repository at this point in the history
To align with the new feature of diagnosis in the terminal
output, the json
  • Loading branch information
Yanqiao4396 committed Feb 25, 2023
1 parent 37129d9 commit 27703c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gatorgrade/output/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/output/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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\ ',
Expand All @@ -256,6 +257,7 @@ def test_json_report_file_created_correctly():
"File": "hello-world.py",
},
"status": False,
"diagnostic":"\"<class 'gator.exceptions.InvalidSystemArgumentsError'>\" thrown by GatorGrader",
},
],
}
Expand Down

0 comments on commit 27703c6

Please sign in to comment.