This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-06
Channels
- # aleph (13)
- # announcements (1)
- # babashka (89)
- # beginners (23)
- # calva (14)
- # circleci (7)
- # clj-kondo (39)
- # clj-on-windows (1)
- # cljdoc (5)
- # cljsrn (29)
- # clojure (98)
- # clojure-art (3)
- # clojure-conj (5)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojurescript (18)
- # clr (39)
- # code-art (3)
- # community-development (3)
- # cursive (3)
- # emacs (11)
- # events (1)
- # fulcro (12)
- # graalvm-mobile (16)
- # graphql (3)
- # gratitude (1)
- # honeysql (19)
- # java (7)
- # joyride (23)
- # lsp (22)
- # malli (2)
- # missionary (25)
- # off-topic (15)
- # polylith (15)
- # rdf (5)
- # reagent (9)
- # reitit (3)
- # scittle (3)
- # shadow-cljs (37)
- # slack-help (2)
- # sql (10)
Where should I put test resources in components?
This is the structure I am using,
components/
{my-component}/
src/
test/
{top-namepsace}/
{my-component}/
test-resources/
(resources for test only)
deps.edn
in deps.edn
:aliases {:test {:extra-paths ["test"]
poly check
gives me, Warning 205: Non top namspace test-resources was found in {my-component}
.
Putting it alongside test
is more common in Clojure-land, I think the same is true specifically for polylith. E.g.:
components/
{my-component}/
src/
test/
{top-namepsace}/
{my-component}/
test-resources/
(resources for test only)
deps.edn
:aliases {:test {:extra-paths ["test" "test-resources"]
You're getting the same warning? Are you sure?
If you've added test-resources to the classpath, it shouldn't be the top namespace anymore. I'm surprised you're seeing the same warning as before.
If it's not exactly the same (i.e. different top namespace), do you happen to have any .clj*
files in test-resources by any chance?
The problem is that the poly tool checks for non top namespaces in all directories, except if they have the name resources
which means that you will get this warning right now, even though test-resources
is also a resources directory. You can verify that by typing:
poly ws get:components:my-component:non-top-namespaces
…and it will list the directories in test-resources
that it thinks are top namespaces.
A solution could be to also treat test-resources
as a resources directory, and skip it in the 205 warning. I can create an issue.I created issue https://github.com/polyfy/polylith/issues/276.
I put these things under test/top-ns/* alongside the test source
When I think about it, I think that is a good solution (what Sean suggests) so I will close issue 276 for now at least.
@U04V70XH6 Then, do you access all the test resource files through the path with the underbar?
Via whatever is the correct classpath-relative path... (Guess I'm not really sure what you're asking?).
What you can do also @U027B5AEPCG if you want to separate the resources from the source files, you can add one more source test directory test-resources
and then add it to deps.edn
e.g. :aliases {:test {:extra-paths ["test" "test-resources"]
.