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

Added JUnit.xml support via --format junit #296

Closed
wants to merge 1 commit into from

Conversation

wscourge
Copy link

Addresses #295.

Shamelessly based on sj26/rspec_junit_formatter. I additionally validated the spec/erb_lint/fixtures/junit.xml with xmlvalidation.com for a good measure.

This is a minimal example, without timings and hostnames, but good enough to display this test summary on GitlabCI, and I assume on other CI interfaces as well.

image

Copy link
Member

@etiennebarrie etiennebarrie left a comment

Choose a reason for hiding this comment

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

What do you think about using REXML, that's part of the standard library, to generate the XML, assert the generated values in test?

# frozen_string_literal: true

require "spec_helper"
require "pry"
Copy link
Member

Choose a reason for hiding this comment

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

This causes the test file to fail.

Comment on lines +4 to +8
<property name="erb_lint_version" value="0.3.1" />
<property name="ruby_engine" value="ruby" />
<property name="ruby_version" value="3.1.2" />
<property name="ruby_patchlevel" value="20" />
<property name="ruby_platform" value="arm64-darwin21" />
Copy link
Member

Choose a reason for hiding this comment

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

These fail the test unless we're using the exact same ruby version as you did.

@etiennebarrie
Copy link
Member

etiennebarrie commented Jan 4, 2023

Here's an example of using REXML https://github.com/Shopify/ci-queue/blob/941e4fe39a5bfdfc3bb8c0ec2c5a0dfa71075c3e/ruby/lib/minitest/queue/junit_reporter.rb

Testing your branch worked well in Buildkite as well, but one thing I noticed is that the line number is missing. According to that code, it seems like you can add a lineno attribute: https://github.com/Shopify/ci-queue/blob/941e4fe39a5bfdfc3bb8c0ec2c5a0dfa71075c3e/ruby/lib/minitest/queue/junit_reporter.rb#L77

@wscourge
Copy link
Author

wscourge commented Jan 5, 2023

Sure thing, I'll look into it - thanks.

@mikoto2000
Copy link
Contributor

@wscourge @etiennebarrie
May I take over and continue with this pull request? I will to respond to the comments and modify it to use REXML.

@wscourge
Copy link
Author

@mikoto2000 fine by me, thanks for doing this, and sorry for my negligence. Cheers.

@mikoto2000
Copy link
Contributor

@wscourge Thank you. I will fork wscourge:main and create new pull request.

@wscourge
Copy link
Author

OK, closing this one

@wscourge wscourge closed this May 22, 2023
@mikoto2000 mikoto2000 mentioned this pull request May 30, 2023
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.

3 participants