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

[feature request] being able to detect all test modules #3

Closed
sequencer opened this issue Nov 7, 2021 · 2 comments · Fixed by #74
Closed

[feature request] being able to detect all test modules #3

sequencer opened this issue Nov 7, 2021 · 2 comments · Fixed by #74
Milestone

Comments

@sequencer
Copy link

These two lines indicate mill-jacoco only support test package in test name:

excludeSources = "__.test.allSources",
excludeCompiled = "__.test.compile"

for other packages foo extends Tests or bar extends Tests cannot be detected by Jacobo.
a cursed idea is finding a directory having testFramework(or some internal test api) to automatically detect the test packages

@lefou
Copy link
Owner

lefou commented Nov 7, 2021

It's not clear to me what you want to achieve. The basic idea behind these parameters was to have a simple way to select sources. Because of the way how Mill works, a __.allSources also includes tests, which we then exclude.

Do you want to exclude Mill modules/targets or do you want to inspect arbitrary Java source file whether they implement some kind of test framework? I'm assuming the former.

If you only want to catch more test modules (e.g. when you have test projects, that have other names), it's probably easier to just inspect all modules and detect tests by the fact that they implement trait TestModule or trait JacocoTestModule.

It would be nice, if Mill had some way to select modules by type. E.g _:TestModule

@lefou
Copy link
Owner

lefou commented Feb 1, 2024

I just opened a PR in Mill that added type filters: com-lihaoyi/mill#2997

After it is merged, we should be able to express exactly the right sources:

__:JavaModule:^TestModule.sources

@lefou lefou closed this as completed in #74 Feb 6, 2024
lefou added a commit that referenced this issue Feb 6, 2024
This prepared mill-jacoco to better catch exactly the correct module
sources. It especially detects any custom test module and excludes it's
coverage data from the reports. Perviously, we only detected test
modules by naming conventions, which was rather sloppy.

Fix #3

This feature only works when used with Mill 0.11.7 or newer. This is a
soft requirement and will checked at runtime.

Pull request: #74
@lefou lefou added this to the after 0.0.3 milestone Feb 6, 2024
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 a pull request may close this issue.

2 participants