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

Update the Rspec::Parser to ignore simplecov output mixed into the rspec json #91

Merged
merged 5 commits into from
Jun 4, 2023

Conversation

nevinera
Copy link
Owner

@nevinera nevinera commented Jun 4, 2023

simplecov-html, the default simplecov output formatter, dumps text output into stderr even when rspec is asked for --format json, causing the output stream to be unparseable. While this is truly an issue with simplecov (and I've started a conversation here), we can work around it from our end because the text being written into the output stream is very limited and specific.

So - as part of parsing the output of rspec, look for non-json simplecov output strings and strip them from the text before json-parsing.

You can actually produce this error on this repository in main by running SIMPLECOV=true bin/qq, which totally passes in this branch ;-)

worth noting (and I did so) that there are hundreds of rspec plugins,
and any of them can write to stdout, alongside your own rspec configuration.
We won't be trying to resolve all such issues, only those with the most
common libraries (and we'll prefer to resolve them by helping libraries
to avoid writing non-json into rspec's json output).
@nevinera nevinera marked this pull request as ready for review June 4, 2023 01:23
Copy link
Collaborator

@cdimartino cdimartino left a comment

Choose a reason for hiding this comment

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

💯

Comment on lines +33 to +34
.gsub(/Coverage report generated.*covered.$/, "")
.gsub(/Encoding problems with file.*$/, "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔪

@nevinera nevinera merged commit f1d3763 into main Jun 4, 2023
7 checks passed
@nevinera nevinera deleted the nev-86--ignore-simplecov-output-in-rspec-runs branch June 4, 2023 17:22
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.

None yet

2 participants