Closed jelaniwoods closed 3 years ago
@jelaniwoods Do you think some sort of truncating would be helpful? For me the output is quite long.
Looking through, I see ":exception":{":class":"NameError",":message":"uninitialized constant Director"
. I wonder if that would be consistently there in these cases, if we could parse the JSON and only display that part, and whether that would be an improvement for the students.
@raghubetina
Looking through, I see
":exception":{":class":"NameError",":message":"uninitialized constant Director"
. I wonder if that would be consistently there in these cases, if we could parse the JSON and only display that part, and whether that would be an improvement for the students.
@raghubetina Ah, I see. In my testing, this :exception
hash doesn't appear to be populated if an error occurs outside of the examples.
We can customize the summary line for regular errors as well if that would be helpful?
In the "error occurred outside of examples" case, we only have the messages Array, which isn't formatted very well.
messages
[
[0] "\nAn error occurred while loading ./spec/models/models_spec.rb.\nFailure/Error: Director\n\nNameError:\n uninitialized constant Director\n# ./spec/models/models_spec.rb:2:in `<main>'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n"
]
{":version":"3.9.3",":messages":["\nAn error occurred while loading ./spec/models/models_spec.rb.\nFailure/Error: Director\n\nNameError:\n uninitialized constant Director\n# ./spec/models/models_spec.rb:2:in `<main>'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n"],":examples":[],":summary":{":duration":7.1e-05,":example_count":0,":errors_outside_of_examples_count":1,":failure_count":0,":pending_count":0,":total_points":0,":earned_points":0,":score":0},":summary_line":"0 tests, 0 failures, 0/0 points, An error occurred while running tests\nAn error occurred while loading ./spec/models/models_spec.rb.\nFailure/Error: Director\n\nNameError:\n uninitialized constant Director\n# ./spec/models/models_spec.rb:2:in `<main>'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n# /Users/jelani/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'\n"}%
It doesn't seem as standard so I wasn't sure how to truncate it.
@jelaniwoods Ah I gotcha. Perhaps we can make a card to consider customizing the summary line for regular errors; for this outside of examples case, LGTM :ship:
Resolves https://github.com/firstdraft/grade_runner/issues/44
To run locally, you can clone any appdev project and replace the
json_output_formatter.rb
with these updates and then runYou could alternatively run
rails grade
with any active token and view the results in the grades UI.