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

Prevent removal of ErrorSpecNode by Maven #1447

Merged
merged 4 commits into from
Mar 14, 2022

Conversation

kriegaex
Copy link
Contributor

Fixes #1444.

At the moment, SpockEngineDiscoveryPostProcessor#processSpecNode creates an ErrorSpecNode (which implements org.junit.platform.engine.TestDescriptor) after catching errors thrown by extensions, which is then silently discarded by Maven Surefire because it filters for testPlan.containsTests(). Therefore, we have to make sure that containsTests returns true. An easy way to do that is to override mayRegisterTests(). Another way would be to override isTest() instead, but actually neither an error node nor a spec actually is as test, they rather can contain tests.

@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #1447 (16336c8) into master (fb73040) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1447      +/-   ##
============================================
- Coverage     79.52%   79.50%   -0.02%     
- Complexity     4005     4006       +1     
============================================
  Files           404      404              
  Lines         12546    12547       +1     
  Branches       1641     1641              
============================================
- Hits           9977     9976       -1     
- Misses         1974     1976       +2     
  Partials        595      595              
Impacted Files Coverage Δ
...java/org/spockframework/runtime/ErrorSpecNode.java 85.71% <100.00%> (+2.38%) ⬆️
...ckframework/mock/runtime/DefaultMethodInvoker.java 70.00% <0.00%> (-10.00%) ⬇️

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 fb73040...16336c8. Read the comment docs.

The advantage is that in javadoc we can actually link to other methods
easily, which also helps when working with the class in an IDE, because
it allows navigation and pop-up javadoc for parent or otherwise related
methods.
leonard84
leonard84 previously approved these changes Mar 14, 2022
@leonard84 leonard84 changed the title Override JUnit's TestDescriptor.mayRegisterTests for ErrorSpecNode Prevent removal of ErrorSpecNode by Maven Mar 14, 2022
@leonard84 leonard84 enabled auto-merge (squash) March 14, 2022 08:18
@leonard84
Copy link
Member

@kriegaex thanks for the PR

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.

Exceptions thrown by extensions invisible in Maven build logs
2 participants