Skip to content

Allow for output format to differ between stdout and report file #345

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

Merged

Conversation

martin-schulze-vireso
Copy link
Member

@martin-schulze-vireso martin-schulze-vireso commented Aug 21, 2020

This mainly deals with #342 but might incorporate #341 as well.

@martin-schulze-vireso martin-schulze-vireso requested a review from a team as a code owner August 21, 2020 23:47
@martin-schulze-vireso martin-schulze-vireso force-pushed the feature/separate-report-mode branch 2 times, most recently from 99b2ddc to 72ad0c3 Compare August 28, 2020 22:09
@martin-schulze-vireso
Copy link
Member Author

This should also fix #311 now. While working on the escaping of the CDATA sections I noticed the problem is more widespread. We also need to escape those parts where file names, test names, or skip messages are inserted, as they might contain characters that break the xml.

Hence, I opted for using xml escape sequences like < instead of the CDATA only solution.

@martin-schulze-vireso martin-schulze-vireso force-pushed the feature/separate-report-mode branch 6 times, most recently from 8ed7e14 to b060bf1 Compare September 2, 2020 21:47
@martin-schulze-vireso martin-schulze-vireso force-pushed the feature/separate-report-mode branch 2 times, most recently from 87b332f to 22cb89f Compare September 12, 2020 18:54
@sublimino sublimino force-pushed the feature/separate-report-mode branch 2 times, most recently from 20ff78b to 2f01516 Compare September 16, 2020 13:31
@sublimino
Copy link
Member

I've added a commit, this looks great.

One question is flag names, currently --formatter and --report. Should the latter be --reporter?

I also think the -help text has got messy, I'll get round to cleaning that up.

@martin-schulze-vireso
Copy link
Member Author

Yes, I also thought about that but reporter is a loaded word. If we are okay with a long name I would opt for --report-format[ter].

@martin-schulze-vireso
Copy link
Member Author

martin-schulze-vireso commented Sep 17, 2020

I just noticed that there is a problem when we want to use a report formatter that uses the internal extended syntax and the tap formatter which simply forwards the input. We can either forbid this combination or we have to implement a filter function on the tap formatter or we live with the invalid tap output.

@martin-schulze-vireso martin-schulze-vireso force-pushed the feature/separate-report-mode branch 2 times, most recently from d99b941 to e1b1c3f Compare September 25, 2020 18:54
@martin-schulze-vireso martin-schulze-vireso changed the title WIP: Allow for output format to differ between stdout and report file Allow for output format to differ between stdout and report file Sep 25, 2020
@martin-schulze-vireso
Copy link
Member Author

I made the TAP formatter compatible with extended syntax. For this I added lib/bats-core/formatter.bash to centralize the parsing logic and use callbacks for the individual formatters. I only implemented this for tap and pretty, we should move the others over to this interface as well.

In the long run this offers the opportunity to check if the formatters implement the interface correctly by at least having a definition of these callbacks, which might pave the way for a stable interface to move formatters out of bats-core.

@sublimino
Copy link
Member

sublimino commented Oct 1, 2020 via email

@martin-schulze-vireso martin-schulze-vireso force-pushed the feature/separate-report-mode branch 3 times, most recently from b24edf8 to 3559357 Compare October 1, 2020 22:18
@martin-schulze-vireso
Copy link
Member Author

@sublimino You can review now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants