Fork me on GitHub
#polylith
<
2023-08-31
>
J09:08:04

Hi guys! It’s possible to use a base in a project only for test purpose?

J09:08:49

Thanks @U1G0HH87L. I add a base poly/my-base in the test alias of a project but I got this: Missing components in the xxx project for these interfaces. I try to add the interfaces in the test alias but same error.

tengstrand10:08:09

If you export your workspace with e.g. clojure -M:poly ws out:ws.out by using the latest sha from master (`48d8a14d31a02cd2229d99bca094fe383d3dcace`) and send it to me, then I can have a look.

J11:08:48

With the lastest sha I hava an edamame error. I have export the workspace with the lastest release.

tengstrand12:08:19

What was the edamame error?

J13:08:04

Here the whole stacktrace

tengstrand14:08:27

Now I remember. I think this has been fixed in the 318 branch, try this instead d239f8b2cfd950bf5c2f7a757e51b7aacf6e92ca.

tengstrand14:08:57

And do a new export.

J14:08:59

Interesting fact with this sha I have no error when I do an info . Here the new export:

J14:08:11

But when I launch the testing of a project. Librairies under the test alias (like my-base) are including to the tests too with all the other librairies in deps. I don’t know if it’s possible to use a librairie for test purpose but not executed her tests.

tengstrand15:08:50

I’m busy tonight, but will have a look tomorrow.

J15:08:45

No problem

👍 2
seancorfield17:08:13

Yes, this is the same issue I ran into at work. You can :exclude that base from testing in the project that uses it just for tess.

seancorfield17:08:14

@UHZPYLPU1 Here's a snippet from our workspace.edn file:

"wsbilling-member"  {:alias "bm"
                                 :test {:setup-fn    ws.application-fixtures.interface/pre-test
                                        :teardown-fn ws.application-fixtures.interface/post-test}}
            "wsbilling-rebill"  {:alias "br"
                                 :test {:exclude     ["billing-member"]
                                        :setup-fn    ws.application-fixtures.interface/pre-test
                                        :teardown-fn ws.application-fixtures.interface/post-test}}
billing-member is a base that is used as a test-only dependency in the wsbilling-rebill project
:aliases
 {:test {:extra-paths []
         :extra-deps  {poly/billing-member {:local/root "../../bases/billing-member"}

                       poly/application-fixtures {:local/root "../../components/application-fixtures"}
                       poly/billing-fixtures {:local/root "../../components/billing-fixtures"}
                       poly/error-reporter {:local/root "../../components/error-reporter"}
                       poly/web-middleware {:local/root "../../components/web-middleware"}
                       poly/web-server {:local/root "../../components/web-server"}

                       com.github.seancorfield/expectations {:mvn/version "2.0.165"}
                       io.github.matthewdowney/rich-comment-tests {:mvn/version "v1.0.3"}}}
That's the :test alias in projects/wsbilling-rebill/deps.edn

seancorfield17:08:30

We're using this SHA for :poly:

:sha "48d8a14d31a02cd2229d99bca094fe383d3dcace"

J08:09:03

Thanks you so much @U04V70XH6 I will try the :exclude

tengstrand08:09:11

I had a look at your workspace @UHZPYLPU1. I'm working on moving all the poly tool documentation to cljdoc in the issue-318 branch (work in progress). The :exclude "trick" is described https://github.com/polyfy/polylith/blob/issue-318/doc/testing.adoc#include-and-exclude-bricks in that branch. I also noticed that you have a few Warning 202 where missing paths are detected. You get that error if you refer to a missing file/directory in a deps.edn config file. You can get rid of them if you remove the reference to them. All missing files can be listed with poly ws get:paths:missing (you had a few). You also have a Warning 205 that you have to live with till the issue https://github.com/polyfy/polylith/issues/305 has been implemented.