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

Add failure message assertions to Gradle's "expect failure" tests #4693

Merged
merged 2 commits into from Apr 7, 2022

Conversation

3flex
Copy link
Member

@3flex 3flex commented Apr 7, 2022

When working on #4687 I found some tests that should have failed after making changes, but didn't.

This is because some tests expected the Gradle job to fail, but didn't check the reason for the failure - so the test would be green even when it wasn't behaving correctly.

This PR adds failure message assertions when using runDetektTaskAndExpectFailure or runTasksAndExpectFailure where that was missing, and fixes a couple of tests that had problems in the specified build file that were found as a result.

I considered adding a required string parameter to those two functions to ensure a message was always provided, which would be a way to avoid this in future, but that could be done separately if desired.

@3flex 3flex changed the title Gradle plugin failure assertions Add failure message assertions to Gradle's "expect failure" tests Apr 7, 2022
@3flex 3flex added the housekeeping Marker for housekeeping tasks and refactorings label Apr 7, 2022
@codecov
Copy link

codecov bot commented Apr 7, 2022

Codecov Report

Merging #4693 (6591161) into main (ed8b089) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4693   +/-   ##
=========================================
  Coverage     84.45%   84.45%           
  Complexity     3436     3436           
=========================================
  Files           492      492           
  Lines         11335    11335           
  Branches       2082     2082           
=========================================
  Hits           9573     9573           
  Misses          701      701           
  Partials       1061     1061           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed8b089...6591161. Read the comment docs.

@cortinico cortinico added this to the 1.20.0 milestone Apr 7, 2022
@cortinico cortinico merged commit 6fe3aab into detekt:main Apr 7, 2022
@3flex 3flex deleted the gradle-plugin-failure-assertions branch April 7, 2022 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Marker for housekeeping tasks and refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants