Replies: 1 comment 13 replies
-
First of: Target implementations do not need to be part of shadow-cljs. They can be developed as a library or bundled with shadow-cljs. I'm happy to help out regardless. However, I just don't have the slightest clue what cypress does or requires. Generating some extra files is trivial, generating a full new build definitely seems like overkill. Is there some documentation that explains how cypress builds and runs the code? is it node? does it run webpack or similar? Does it need code organized in specific ways, apart from the |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I recently started using shadow-cljs in favor to other options to compile my cljs projects. One reason was to be able to use storybook for (react) components. Another thing I would like to do is use cypress for e2e and component testing.
Now this might seem not an issue for shadow-cljs but please let me explain my rationale here:
Cypress is a JS testing framework for e2e and recently also component tests. Right now the only way I found how to use cypress with Clojurescript (and shadow-cljs) is the cypress-clojurescript-preprocessor. What this does is basically generate a new build configuration for each test and compile clojurescript into JS bundles. For each test file a new js bundle gets generated which is then loadable by cypress.
This approach is okeh-ish but might get problematic when there will be many hundreds(?) of tests files. And its not very elegant.
A more elegant way I believe would be to have a build target in shadow-cljs that will analyze the Clojurescript modules following a
:ns-expression
like i.e."-test$"
, generate a JS test file for each module that can then be imported by cypress. This is exactly not how the current:browser-test
target works which creates a single bundle with all tests (and other code).This approach would be similar to how I currently compile the Clojurescript code into JS to be usable in storybook: here I simply use the
:node-module
target which will then not generate a bundle but independent JS files for each module. Using this target does unfortunately not work with cypress for reasons not 100% clear to me.I would like to use this post to get feedback if anyone else has tried something like this and if this could be an interesting thing for other developers who would like to use shadow-cljs with cypress.
P.S. Here is a discussion about the rationale in the preprocessor linked above.
Beta Was this translation helpful? Give feedback.
All reactions