Merged
Conversation
The runner is pretty high-level, if tests are running without involving the cli offenses aren't being rejected
551c0f9 to
4f0e1e3
Compare
This moves most tests to run inline instead of spawning an extra process. This isn't only faster but also much more explicit in what is actually being tested against. A few tests are left intact for issues that actually manifested during live rubocop runs.
4f0e1e3 to
8a32f40
Compare
palkan
approved these changes
Dec 18, 2023
Collaborator
palkan
left a comment
There was a problem hiding this comment.
LGTM 👍
Let's fix the conflict and merge it
Contributor
Author
|
Hm, there seems to be some incompatibility with how you apply autocorrect on early rubocop versions. Would you mind me bumping the minimum required version here already so I don't have to look into that only to remove it later anyways? Just passing in the older |
Collaborator
Yeah, I think we can do that given that 1.0.0 is more than 3 years old. |
The new test harness has issues with older versions and it's planned to bump to 1.45 anyways for its introduction of 3rd party templating support
Contributor
Author
Great to hear, should be all good now! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of what I wanted to do for #30 but this is pretty big already. Pulled it out so it doesn't get unreviewable.
This pulls in the test harness of
rubocop-minitest. Tests are easier to read, more explicit in what's happening, more broad in their expectations, and also just faster.The first commit hooks earlier into rubocop when irrelevant invalid offenses are removed, needed for
test_non_code_offensesto work. Since the runner isn't involved anymore this test would otherwise fail. The test suites passes with this commit in isolation.InvestigationReporthas been added in rubocop 0.87 rubocop/rubocop@f8813e7Second commit is the rewrite. Since normally cops are tested one by one I needed to make some tweaks to the assertion module to make sense for this gem, where all cops are being run at once. I've isolated these changes to their own class. rubocop/rubocop-minitest#278 proposes to make the base assertions reusable by other gems, if that gets merged then this would be a drop in replacement.
I moved most of the tests to this new setup, but left those that clearly had something to do with some options being passed to rubocop, like the config test or the one with the cache. Most just asserted that offenses happened.
Test suite before: ~25.5 seconds
Test suite now: ~9.5 seconds