This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-31
Channels
- # aleph (24)
- # announcements (2)
- # aws (1)
- # babashka (2)
- # beginners (46)
- # calva (15)
- # chlorine-clover (1)
- # clojure-europe (27)
- # clojure-nl (3)
- # clojure-norway (13)
- # clojure-uk (7)
- # clojurescript (16)
- # datomic (29)
- # emacs (4)
- # fulcro (16)
- # hugsql (6)
- # hyperfiddle (65)
- # lsp (9)
- # malli (3)
- # off-topic (29)
- # pedestal (1)
- # releases (1)
- # shadow-cljs (52)
- # specter (5)
- # xtdb (1)
Hey, yet another question about async tests running on node :)
I've managed to make this async test work fine, but whenever it throw an error inside a promise it is catch and logged by the p/catch
function, but the test suite returns status code 0.
https://github.com/rafaeldelboni/helix-jsdom-portfolio-mantine/blob/main/tests/main/mantine_test.cljs
I've tried to rethrow the error or even throwing a new error, but nothing seems to change the exit code.
Anyone knows how to fix this?
is case of catch
you also need to call (done)
, otherwise it won't know the test finished
uhmm thanks I will try
I changed the catch fn to:
(fn [err]
(js/console.error err)
(done))
And now the return of the test suit is better, but dont states the failing error:adding an (is (= nil err))
in the catch fn does the trick, maybe I will write an macro to wrap all of this
I’m working my way through Web Development With Clojure, and I’m stuck on the beginning of Chapter 3 when the first ClojureScript example appears. It consists of a simple “Hello World” exercise in cljs, starting on page 74. First, you update project.clj with the dependencies and configuration options:
:dependencies
[...
[org.clojure/clojurescript "1.10.764" :scope "provided"]]
...
:resource-paths ["resources" "target/cljsbuild"]
:target-path "target/%s/"
:main ^:skip-aot guestbook.core
:plugins [[lein-cljsbuild "1.1.8"]]
:cljsbuild
{:builds
{:app {:source-paths ["src/cljs"]
:compiler {:output-to "target/cljsbuild/public/js/app.js"
:output-dir "target/cljsbuild/public/js/out"
:main "guestbook.core"
:asset-path "/js/out"
:optimizations :none
:source-map true
:pretty-print true}}}}
:clean-targets
^{:protect false}
[:target-path
[:cljsbuild :builds :app :compiler :output-dir]
[:cljsbuild :builds :app :compiler :output-to]]
Then you create your Clojurescript in /src/cljs/guestbook/core.cljs
(ns guestbook.core)
(-> (.getElementById js/document "content")
(.-innerHTML)
(set! "Hello, World!"))
Then you modify /resources/html/home.html to run the compiled JavaScript
{% extends "base.html" %}
{% block content %}
<input id="token" type="hidden" value="{{csrf-token}}" />
<div id="content"></div>
{% endblock %}
{% block page-scripts %}
{% script "/js/app.js" %}
{% endblock %}
Then you run the following Leiningen commands:
lein cljsbuild once
lein run
...navigate to localhost:3000 and you're supposed to see your Hello, World! Instead, I get messages that everything compiled and the server started successfully, but the home.html content block is blank.
Any hints on what I might be doing wrong? I'm running Clojure 1.10.1 on Windows 10 with Java 17.0.9 (Temurin-17.0.9+9), and everything in the tutorial runs fine right up to this point.Check the browser's "Developer Tools" and especially especially the "Console" and "Network" parts of it.
What am I looking for?
I'm not new to programming, but I'm new to web development. I've been playing around with Clojure for a while and think I've largely gotten the hang of it. Just trying to figure out why my Luminus app is ignoring my Clojurescript so I can move forward to the next phase.
Oh man. I switched my browser from Edge to Chrome and it works on Chrome. Sounds like a Microsoft problem :rolling_on_the_floor_laughing: