Fork me on GitHub
#polylith
<
2021-11-30
>
Nikolas Pafitis14:11:40

I have a polylith workspace which i recently migrated to the newer workspace.edn version. After the migration, I can't seem to be able to run my component's tests using poly test :dev. The issue is that i have a helper namespace in {project-root}/test/{org}/test/with_system.cljc for my tests, which i added to the :test alias and is indexed fine by Intellij, but poly test runner can't seem to find it

Caused by: java.io.FileNotFoundException: Could not locate fully/test/with_system__init.class, fully/test/with_system.clj or fully/test/with_system.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
In terms of previous discussion, I've switched back to :extra-paths way of importing my components to the dev alias just in case.

tengstrand14:11:13

I’m not exactly sure I follow where you put the with_system.cljc file. Maybe you can execute the tree command so that I see exactly where you put it.

Nikolas Pafitis14:11:22

├── bases
│   └── server
│       ├── deps.edn
│       └── src
│           └── fully
│               └── server
│                   └── core.clj
├── components
│   ├── 
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── config
│   │               ├── api.cljc
│   │               └── core.cljc
│   ├── errors
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── errors
│   │               ├── api.clj
│   │               └── core.clj
│   ├── logger.timbre
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── logger
│   │               ├── api.clj
│   │               └── core.clj
│   ├── middleware
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── middleware
│   │               ├── api.clj
│   │               └── core.clj
│   ├── repository.crux
│   │   ├── deps.edn
│   │   ├── src
│   │   │   └── fully
│   │   │       └── repository
│   │   │           ├── api.clj
│   │   │           └── core.clj
│   │   └── test
│   │       └── fully
│   │           └── repository
│   │               └── core_test.clj
│   ├── resolver.pathom
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── resolver
│   │               ├── api.clj
│   │               └── core.clj
│   ├── ring-handler.reitit
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── ring_handler
│   │               ├── api.clj
│   │               └── core.clj
│   ├── ring-server.jetty
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── ring_server
│   │               ├── api.clj
│   │               └── core.clj
│   ├── routes.default
│   │   ├── deps.edn
│   │   └── src
│   │       └── fully
│   │           └── routes
│   │               ├── api.clj
│   │               └── core.clj
│   ├── schema.malli
│   │   ├── deps.edn
│   │   ├── src
│   │   │   └── fully
│   │   │       └── schema
│   │   │           ├── api.cljc
│   │   │           └── core.cljc
│   │   └── test
│   │       └── fully
│   │           └── schema
│   │               └── core_test.cljc
│   └── system
│       ├── deps.edn
│       └── src
│           └── fully
│               └── system
│                   ├── api.clj
│                   └── core.clj
├── config
│   └── dev
│       └── env.edn
├── default-registry
│   └── auth
│       └── auth.edn
├── deps.edn
├── development
│   ├── resources
│   │   └── schema.edn
│   └── src
│       ├── dev.clj
│       └── system.clj
├── fully.iml
├── logo.png
├── projects
├── protocols
│   └── src
│       └── fully
│           └── protocols
│               ├── repository.clj
│               ├── resolver.clj
│               ├── ring.clj
│               └── schema.cljc
├── readme.md
├── test
│   └── fully
│       └── test
│           └── system.cljc
└── workspace.edn

Nikolas Pafitis14:11:26

I renamed with_system.cljc to system.cljc in hopes that that could be the issue

tengstrand15:11:20

Try putting the namespace under projects/testproj/fully/test/system.cljc.

Nikolas Pafitis15:11:01

but then i would have to run the test runner using that project no?

tengstrand15:11:07

I changed my mind! Maybe you can put that test code in a component instead, like test-helper or similar?

Nikolas Pafitis15:11:44

Hmm I'll try it out and come back to you

👍 1
Nikolas Pafitis16:11:10

@U1G0HH87L went with this approach and it looks like it works.

└── test-helper
    ├── deps.edn
    └── src
        └── fully
            └── test_helper
                └── with_system.cljc

Nikolas Pafitis16:11:13

Although now when i do poly test :dev it appears as a tested component which is not necessarily true.

Running tests from the development project, including 3 bricks: repository.crux, schema.malli, test-helper

Nikolas Pafitis16:11:41

My deps.edn looks like this:

:test {:extra-paths ["components/test-helper/src"
                                "components/repository.crux/test"
                                "components/schema.malli/test"]}

tengstrand17:11:43

But it is part of the test execution (used by other tests). Also, you should rename the components that have a dot in their names, like from shchema.malli to shema-malli .

Joshua Suskalo20:11:56

What is this workspace.edn file used for? It's generated by the tool but I haven't seen anything to indicate that it's used for anything.

Joshua Suskalo20:11:04

Is there documentation on it somewhere?

tengstrand20:11:05

The different keys are explained through out the documentation, with start from the https://polylith.gitbook.io/poly/architecture/workspace section.

Joshua Suskalo21:11:35

Thanks for the responses

👍 1