-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Introduce mechanism to enable specific global extensions in JUnit Jupiter #3717
Comments
Thanks for the proposal, @translatenix. We'll discuss it within the team during an upcoming team call and get back to you. |
Team decision: Introduce |
Addendum: The new properties should support the same pattern matching syntax supported for other configuration parameters. |
One use case would be to enable |
Can I Contribute? |
Yes, feel free to submit a PR for review. |
It seems like I think it should be able to accept multiple folders and multiple classes. |
Yes, comma-separated entries with wildcard matching. |
hello. I've been thinking about how to implement this feature, and I've come up with 2 approaches. Basically, both approaches involve replacing the extension that is registered in registerAutoDetectedExtension method. 1st approachmain...dev-jonghoonpark:junit5-forked:implement-all-callbacks Create an AutoDetectedExtension that implements all possible callbacks. Let the AutoDetectedExtension contain the originalExtension and perform the callbacks when conditions are matched. Disadvantages :
2nd approachmain...dev-jonghoonpark:junit5-forked:use-proxy Use a proxy to intercept the callback function when it is executed and check the path. If it matches the conditions, perform the callback. Disadvantages :
I'm going to try the first of the two approaches, what do you think? If you have a better way, I'd love to hear about it, even if it's a completely different approach. Thank you. |
@dev-jonghoonpark Thanks for looking into this and sorry for not getting back to you sooner! Auto-registration of extensions is already implemented here: Lines 78 to 80 in 89a0201
Therefore, all that should be needed is to implement filtering of the classes loaded via Lines 85 to 88 in 89a0201
For the filtering, exclusions are already implemented in Please let me know if you have any questions. |
Issue: junit-team#3717 Signed-off-by: yongjunhong <[email protected]>
Issue: junit-team#3717 Signed-off-by: yongjunhong <[email protected]>
I've already worked on this in my personal repository, and since there’s a large amount of code changes, I decided to split it into two PRs. I plan to proceed in the following two ways.
The link above is the PR for the first step. |
@YongGoose Thanks! I'll take a look in the next few days! 👍 |
Issue: #3717 --------- Signed-off-by: yongjunhong <[email protected]> Co-authored-by: Marc Philipp <[email protected]>
Issue: junit-team#3717 Signed-off-by: yongjunhong <[email protected]>
Enabling all global extensions on the class/module path with
junit.jupiter.extensions.autodetection.enabled=true
is asking for surprises (and potentially trouble).Instead, I'd like to explicitly enable the global extensions that I want to use.
I imagine that I'd do this by setting
junit.jupiter.extensions.autodetection.enabled=foo.bar.Baz,foo.bar.Qux
or a similar property.If the JUnit team is open to this idea, I'd be happy to discuss further and send a PR.
The text was updated successfully, but these errors were encountered: