Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(outputHandler_json): for pending tests and json encoding #748

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YaroSpace
Copy link

Fix for #729: pending tests without function argument have an attribute of default_fn: <function>, which cannot be encoded into json.
Improved json output formatter to handle pending tests and provide better error reporting if custom non-string attributes cannot be encoded into json.

busted/outputHandlers/json.lua Outdated Show resolved Hide resolved
busted/outputHandlers/json.lua Outdated Show resolved Hide resolved
@YaroSpace YaroSpace force-pushed the master branch 3 times, most recently from 293770f to fea7d53 Compare November 29, 2024 10:50
@YaroSpace YaroSpace requested a review from alerque November 29, 2024 13:05
spec/cl_output_json_spec.lua Outdated Show resolved Hide resolved
spec/cl_output_json_spec.lua Outdated Show resolved Hide resolved
busted/outputHandlers/json.lua Outdated Show resolved Hide resolved
@YaroSpace YaroSpace force-pushed the master branch 2 times, most recently from 5d346ba to 083eae0 Compare November 29, 2024 18:05
Comment on lines +36 to +37
io_write(err_msg)
error(err_msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why write and error the same message? Is this what the other instances in the code base of manually writing to stderr and then exiting are working around?

Suggested change
io_write(err_msg)
error(err_msg)
error(err_msg)

Copy link
Author

@YaroSpace YaroSpace Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my undertading, writing to stdout here is for the cases when json output is redirected to a file, so that the error goes to the file too. I assumed someone maybe relying on that, so left this line just in case, but with a better error message.

@YaroSpace YaroSpace requested a review from alerque December 5, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants