I’m trying to run a test in clojurescript, but the test isn’t running. I’ve this in the file:
(ns humboi.core
(:require [humboi.core :as sut]
["@testing-library/react-native" :refer [render fireEvent]]
[humboi.auth.core :refer [google-sign-in-comp]]
[cljs.test :as t :include-macros true]))
(defn mount! [component]
(render (r/as-element component)
#js {:container (testing-container)}))
(deftest google-login-test
(is (mount! [google-sign-in-comp])))
(cljs.test/run-tests)
After which I’m loading the cider buffer. But the test isn’t running. How to fix this?Looks like non-maintainers are supposed to go through ask clojure. I posted https://ask.clojure.org/index.php/10028/repl-error-workerthreads-is-not-available with details.
Are protocols only implemented at the js prototype level or is there something else going on? Just trying to better understand the performance of a protocol function call vs a "regular" function call
Having a little trouble getting adjusted to the clojurescript tooling.
I created a new re-frame project use lein new re-frame my-app-name
. I'm using emacs so I'm able to start a shadow repl using :cider-jack-in-cljs
. However it blows up after I provider the app name to build.
I figured it would just be my-app-name
Error: Execution error (ExceptionInfo) at shadow.cljs.devtools.server.runtime/get-instance! (runtime.clj:11) . missing instance
Am I looking more for "watch", "dev", etc as defined in project.clj?
Maybe I need to lein watch
first and then jack in via emacs?
oh that template uses the awkward lein-shadow
plugin. if you run lein shadow compile
it will output the correct shadow-cljs.edn file and run npm install and such. After that, you can delete all the lein-shadow stuff and the nested shadow-cljs.edn inside of the project.clj and it will be a normal shadow project
that plugin is an attempt to keep everything inside of the project.clj file. the result is all your dependencies in one file and tooling and documentation no longer match up with the setup so to me its a poor tradeoff
Ah okay! I will go down that route. I appreciate it, I was very confused.
Once I've done that the :cider-jack-in-cljs
should be enough to start the project?
Hey, look at me! I have a running re-frame app!
Thanks, @dpsutton
it might be helpful to explore it in http://app.klipse.tech/
it looks like (and this also matches my memory) calling a protocol method foo
does the following:
• looks up the method on the prototype and if found, executes that
• checks a global registry and if an implementation is found, executes that (this is useful for things like object
and nil
)
there's a third thing that it might do if you allow your protocol to be extended via metadata, which is look it up on the object's metadata and if found, executes the function found there
FWIW there's also #figwheel-main where you might get better traction.
sure, but looks dead
I don’t use django, but use relative paths as well and am not experiencing this. I wonder if there’s some other piece to configure here to make sure those dependencies within your compiled script are resolved differently
@ajarosinski if i look at my dev-mains.js its this:
window.CLOSURE_UNCOMPILED_DEFINES = {"figwheel.repl.connect_url":"ws:\/\/localhost:9500\/figwheel-connect?fwprocess=146268&fwbuild=dev"};
window.CLOSURE_NO_DEPS = true;
if(typeof goog == "undefined") document.write('<script src="/cljs-out/dev/goog/base.js"></script>');
document.write('<script src="/cljs-out/dev/goog/deps.js"></script>');
document.write('<script src="/cljs-out/dev/cljs_deps.js"></script>');
document.write('<script>if (typeof goog == "undefined") console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?");</script>');
document.write('<script>goog.require("figwheel.core");</script>');
document.write('<script>goog.require("figwheel.main");</script>');
document.write('<script>goog.require("figwheel.repl.preload");</script>');
document.write('<script>goog.require("devtools.preload");</script>');
document.write('<script>goog.require("figwheel.main.system_exit");</script>');
document.write('<script>goog.require("figwheel.main.css_reload");</script>');
document.write('<script>goog.require("process.env");</script>');
document.write('<script>goog.require("livematch.core");</script>');
the script src here is literally just target-dir appended with some stuff. At this point i dont even care if i can get relative paths working i just want to be able to have this generate correct/different paths.
I am using the default project produced by lein new figwheel-main app -- --reagent
btwhang on i will try with the +npm-bundle option
meh, idk what to do
how do i just compose like a single js file i can throw into my static files
Looks can be deceiving. :) Library and tool authors and maintainers often pay much closer attention to their own channels than to this general one.
how are you using relative paths btw?
i dont even care about figwheel since i would be fine just producing a single js file for use
i dont understand why this has to be such a horrible confusing process
i think i fixed it for now