-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support scanning tests in src directories #448
Comments
Totally support this feature of |
I use rich-comment-tests (per marksto above) but we follow the recommendation in RCT to have a stub file in the I would never want Plenty of tooling out there doesn't support tests in |
This issue was created to make it easier to work with Hyperfiddle rcf as described here. As it is today, you can add the |
hi @tengstrand , I am a bit unsure after reading the comments. I will try out https://github.com/matthewdowney/rich-comment-tests and probably migrate to it - since it seems a bit less intrusive than RCF . In gradle, src classes are available for tests on the classpath. If the feature is easy to implement and maintain than I am ok with the approach. My experience with Clojure is a bit more limited than some. In gradle, testClasspath contains/has access to compileClasspath . |
FWIW, the https://github.com/seancorfield/polylith-external-test-runner supports Polylith 0.2.20 (SNAPSHOT) supports a |
Can we close this issue? |
As long as you're happy with solving this in specific test runners through their specific config, sure. I don't care whether the built-in test runner supports this :) |
Seems like this could be closed out now. |
I remembered a (n edge) case about this that I encountered when working on polylith-kaocha: if a brick does not have test paths, then the poly tool itself won't consider that brick for testing in I created a repro case at https://github.com/imrekoszo/poly-test-in-src |
Interesting edge case. I guess another workaround is to have a dummy test ns in such bricks? I think I'd be inclined to just document this edge case, and encourage users to add at least a dummy test ns to get The default behavior for most (all?) test runners is not to look for tests in sources, and I get the impression it is discouraged (since you often don't want test code in your deployable artifacts). For the RichCommentTests library (not rcf), the recommendation is to create an explicit test file that invokes tests from RCFs in the source code -- which is an approach we use at work. |
Thanks Sean. I added the dummy test workaround to the repro repo. I noticed two differences between the two workarounds:
If documented well, both these should enable the removal of the hack from polylith-kaocha. I kinda prefer the duplicate paths workaround for the following reasons:
|
I would expect 1. The built-in test runner doesn't support I'll repeat my comments from early March '24:
Test runners don't have to support this. Some test runners do, and in their docs, they can explain how they want it to work:
I will update my external test runner's docs for the first case there. It sounds like you'd prefer the Kaocha runner to follow the second case there (and remove support for |
Thanks for the brainstorming, Sean! I ended up adding a new property to |
@imrekoszo Looking over the changes, it seems like the only effect for my external test runner would be to change I'd still have the same code to select either test code only or test + source code (if And, to confirm, I'd only need to switch the key I use in |
@seancorfield that's correct.
That also sounds correct. Although you don't need to, you made pretty strong arguments for not encouraging keeping tests under |
Thanks. I've updated my external test runner and I'm planning an 0.7.0 release as Polylith reaches its 0.2.22 release. |
People sometimes put test code together with the src code. Today we don't run those tests. It would be good if this could be configurable.
To turn it on globally, we could put an
:include-src-dirs
flag inworkspace.edn
at the root to affect all tests:or per project:
or even per brick:
The text was updated successfully, but these errors were encountered: