Fork me on GitHub
#reagent
<
2024-03-04
>
김태희(taehee kim)13:03:46

Hello. I'm trying to build a component testing environment. Here are the requirements I want, and things I've tried. • out team have a shadow-cljs + reagent project. • render reagent component • in real browser (no jsdom, happy-dom) • with @testing-library/user-event and promise • reliable watch mode! run tests on file save. (without manually evaluate (run-all-tests)

김태희(taehee kim)13:03:59

1. shadow cljs :target :browser-test a. i can't find the way to "run tests on file save" 2. karma! a. https://github.com/karma-runner/karma/?tab=readme-ov-file#karma-is-deprecated-and-is-not-accepting-new-features-or-general-bug-fixes 3. jest-cljs a. i want real browser 4. vitest browser mode + @testing-library/jest-dom a. how can i import cljs component and reagent from vite project? 5. https://github.com/lambdaisland/kaocha-cljs2/blob/main/doc/cljdoc.edn a. https://github.com/lambdaisland/kaocha-cljs2/issues/2

p-himik13:03:24

> i can't find the way to "run tests on file save" If you open the test web page generated by shadow-cljs itself, there will be hot reloading buit-in. Should also work with your own page if it runs tests on load or on hot reload (which can be done with a shadow-cljs hook).

👀 1
p-himik13:03:39

it's watch mode runs before shadow-cljs hot reloadProbably because you have set it to watch the CLJS files. Instead, it should watch the compiled JS files.

👀 1
김태희(taehee kim)13:03:48

Thank you for quick response. It's a good idea to look up the shadow-cljs hook documentation. When I looked up kaocha's document, kaocha watches the dependencies of source codes and namespaces (not the compiled results. it is initially built for clojure not cljs)

김태희(taehee kim)13:03:11

Can you recommend me an existing example repository or something?

p-himik13:03:10

Alas, no - I don't test the components themselves.

🥲 1