Fork me on GitHub
Adrian Smith15:06:14

Hi I’m trying to add a library to my component’s tests, I’ve added it to the component deps.edn :deps {} but it’s not available in my repl Is there anything else I need to do?


What editor are you using and how is that component referenced in your workspace-level deps.edn file?

Adrian Smith16:06:27

I’m using cursive, the components are referenced via :extra-paths in the top level deps.edn duplicating the library I want to include in my tests in both the top level test alias extra-deps and in the component test alias extra deps, means that the library is on my class path in the repl but the duplication feels a bit weird, I’m not sure if that’s the way it should be done


Yes, it's because of Cursive. It has a bug that prevents you using :extra-deps and :local/root which would solve the problem.


It looks like the integration of pluggable test runners has broken some of the assumptions around project test fixtures:

Running test setup for the publisher project: worldsingles.application.fixtures/pre-test

Test setup failed: Syntax error macroexpanding at (worldsingles/user.clj:1:1).
Running test setup for the system project: ws.system.fixtures/pre-test
If the "Test setup failed", the entire test run should abort. It used to abort, and it no longer does.


Okay, I will have a look.


Thanks @U1G0HH87L The worst part about this is that if setup fails for any reason in CI, the pipeline continues on and succeeds -- without running a bunch of tests. I only just happened to notice this today because I was doing a major refactor that broke things and I saw it scroll past in a terminal window. Purely by accident.


I will say that project test fixtures are very much second class in Polylith, check doesn't check them so it doesn't spot that things are missing from the deps needed to run the setup/teardown.


I get OK from check easily, and then spend ages wrestling with getting the project test fixtures to run properly 😞


I suspect this is mostly an interim issue because I have a mix of bricks and legacy subprojects and, right now, the project fixtures are in legacy subprojects...


By the end of next week, I expect to have a lot more bricks and I'll probably be comfortable sending you an up-to-date EDN file that you can use to generate graphics to add to the case studies and include World Singles Networks 🙂


I will try to add a test to catch this, so that it doesn’t happen again.


There are several scenarios to test: 1. If test setup fails, the whole test run should stop (and test teardown should not happen) 2. If test setup succeeds and the tests pass, the test teardown should run and if it fails, the whole test run should stop 3. If test setup succeeds but the tests themselves fails, the test teardown should still happen -- and if it succeeds, behave according to the test failures 4. If test setup succeeds but the tests themselves fails, the test teardown should still happen -- but if that fails, the whole test run should stop I think those are the four main cases required here.


Please see my comments on the issue. To me it appears this hadn't worked pre-pluggable runners either.