lunarmodules / busted

Elegant Lua unit testing.
https://lunarmodules.github.io/busted/
MIT License
1.38k stars 184 forks source link

Fails to encode results to json due to non-string error objects being raised #729

Open svermeulen opened 10 months ago

svermeulen commented 10 months ago

I have a custom error table that I pass to error(foo). When I do this in a busted test, and then pass --output=json, it will just print nothing, due to an error that occurs in json.encode where it is unable to serialize function objects. I'm guessing that busted should run tostring(error_obj) somewhere to address this problem