Fork me on GitHub
#clojurescript
<
2021-01-08
>
zendevil.eth03:01:17

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

zendevil.eth03:01:25

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

Adam Helins15:01:45

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

lilactown19:01:06

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

lilactown19:01:13

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

👍 3
Ty16:01:09

Having a little trouble getting adjusted to the clojurescript tooling.

Ty16:01:56

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.

Ty16:01:05

I figured it would just be my-app-name

Ty16:01:19

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

Ty16:01:15

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

Ty16:01:28

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

dpsutton16:01:49

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

dpsutton16:01:34

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

Ty16:01:32

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

Ty16:01:53

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

Ty16:01:48

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

Daniel Tobias19:01:27

I am using figwheel-main reagent template and having a lot of issues with my django backend. In my figwheel-main.edn i am specifying a target-dir which a relative path to the static folder of my django project. This creates the dev-main.js in the correct spot however the issue is dev-main.js is trying to load dependencies using the same target-dir + some stuff which simply will not do. Is there any way to change this?

AJ Jaro20:01:32

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 Tobias20:01:10

@UGMAVSMUM 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 Tobias20:01:20

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

Daniel Tobias20:01:17

meh, idk what to do

Daniel Tobias20:01:21

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

Daniel Tobias20:01:56

how are you using relative paths btw?

p-himik20:01:14

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

Daniel Tobias20:01:29

sure, but looks dead

☝️ 3
p-himik20:01:46

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 Tobias20:01:09

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

Daniel Tobias20:01:17

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

Daniel Tobias22:01:22

i think i fixed it for now

👍 3