clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
zendevil 2021-01-08T03:07:17.218500Z

I’m trying to run a test in clojurescript, but the test isn’t running. I’ve this in the file:

zendevil 2021-01-08T03:07:25.218700Z

(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?

2021-01-08T04:06:35.219300Z

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.

Helins 2021-01-08T15:52:45.223100Z

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

Ty 2021-01-08T16:02:09.223500Z

Having a little trouble getting adjusted to the clojurescript tooling.

Ty 2021-01-08T16:02:56.224500Z

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.

Ty 2021-01-08T16:03:05.224800Z

I figured it would just be my-app-name

Ty 2021-01-08T16:04:19.225600Z

Error: Execution error (ExceptionInfo) at shadow.cljs.devtools.server.runtime/get-instance! (runtime.clj:11) . missing instance

Ty 2021-01-08T16:08:15.226200Z

Am I looking more for "watch", "dev", etc as defined in project.clj?

Ty 2021-01-08T16:11:28.227700Z

Maybe I need to lein watch first and then jack in via emacs?

dpsutton 2021-01-08T16:11:49.228200Z

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

dpsutton 2021-01-08T16:12:34.229Z

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

Ty 2021-01-08T16:13:32.229300Z

Ah okay! I will go down that route. I appreciate it, I was very confused.

Ty 2021-01-08T16:13:53.229800Z

Once I've done that the :cider-jack-in-cljs should be enough to start the project?

Ty 2021-01-08T16:15:48.231200Z

Hey, look at me! I have a running re-frame app!

Ty 2021-01-08T16:15:53.231400Z

Thanks, @dpsutton

lilactown 2021-01-08T19:11:06.231700Z

it might be helpful to explore it in http://app.klipse.tech/

lilactown 2021-01-08T19:16:13.231900Z

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

👍 1
p-himik 2021-01-08T20:25:14.233100Z

FWIW there's also #figwheel-main where you might get better traction.

Daniel Tobias 2021-01-08T20:27:29.233300Z

sure, but looks dead

☝️ 1
AJ Jaro 2021-01-08T20:29:32.233600Z

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

Daniel Tobias 2021-01-08T20:31:10.233800Z

@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 btw

Daniel Tobias 2021-01-08T20:33:20.234Z

hang on i will try with the +npm-bundle option

Daniel Tobias 2021-01-08T20:36:17.234200Z

meh, idk what to do

Daniel Tobias 2021-01-08T20:39:21.234400Z

how do i just compose like a single js file i can throw into my static files

p-himik 2021-01-08T20:39:46.234600Z

Looks can be deceiving. :) Library and tool authors and maintainers often pay much closer attention to their own channels than to this general one.

Daniel Tobias 2021-01-08T20:44:56.234800Z

how are you using relative paths btw?

Daniel Tobias 2021-01-08T20:47:09.235Z

i dont even care about figwheel since i would be fine just producing a single js file for use

Daniel Tobias 2021-01-08T20:47:17.235200Z

i dont understand why this has to be such a horrible confusing process

Daniel Tobias 2021-01-08T22:26:22.235600Z

i think i fixed it for now

👍 1