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

only print message if console format is used #128

Closed
wants to merge 2 commits into from

Conversation

reinfi
Copy link
Contributor

@reinfi reinfi commented Apr 17, 2024

Bugfix patch for my junit formatter.

Finally found time to test it with CI/CD and found one issue:

�[37mUsing config�[0m /Users/xxx/composer-dependency-analyser.php
<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="shadow dependencies" failures="1"><testcase name="laminas/laminas-uri"><failure>e.g. Laminas\Uri\Uri in src/Infrastructure/ExternalService/Url/UrlService.php:45 (+ 10 more)</failure></testcase></testsuite></testsuites>

The first line breaks the valid xml and I would have to remove it by script.

@janedbal
Copy link
Member

Does junit support any kind of metadata? I'd rather keep those in the xml if possible. There are also other places with similar output.

@reinfi
Copy link
Contributor Author

reinfi commented Apr 17, 2024

Does junit support any kind of metadata? I'd rather keep those in the xml if possible. There are also other places with similar output.

Will check if JUnit does support that, but would require a complete rework as there would be no single point of writing the xml.

I'm quite unsure about all the other lines. If they are just informal output I would need to suppress them all. May be I should add a different printMethod and change the other one that they does not output anything with format 'junit'. That would keep the code much cleaner.

@reinfi
Copy link
Contributor Author

reinfi commented Apr 17, 2024

https://github.com/testmoapp/junitxml

There are some sort of properties that can be defined but that would need to be defined at any testsuite. Also the information from the output would need to be transfered to the JUnit-Formatter.

And the known JUnit-Parser does not display them properly. So if it fine for you I would skip that part for displaying these informal content.

Another, but different idea, would be that we add an output-file as option where the xml would be stored. Then the normal output could also happen but the xml would only be in that file.

@janedbal
Copy link
Member

I'll think about it, but if we decide not to print things in Initializer for junit, I'd rather make Printer an interface and just pass VoidPrinter to Initializer in that case.

@janedbal
Copy link
Member

PHPStan deals with the same issue by using STDERR for informatory message and STDOUT for the regular "formatter output". This seems like a best solution to me.

@janedbal
Copy link
Member

Fixed in 1.5.3

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