This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-22
Channels
- # beginners (124)
- # boot (7)
- # cider (73)
- # cljs-dev (37)
- # cljsrn (6)
- # clojure (85)
- # clojure-greece (4)
- # clojure-italy (67)
- # clojure-nl (6)
- # clojure-russia (4)
- # clojure-spec (6)
- # clojure-uk (48)
- # clojurescript (26)
- # cursive (5)
- # data-science (23)
- # datomic (63)
- # editors (5)
- # emacs (4)
- # graphql (13)
- # immutant (2)
- # lumo (4)
- # mount (3)
- # off-topic (1)
- # onyx (4)
- # pedestal (7)
- # portkey (10)
- # re-frame (14)
- # reagent (10)
- # ring-swagger (18)
- # shadow-cljs (97)
- # spacemacs (1)
- # tools-deps (9)
- # vim (1)
- # yada (13)
=>> cat externs.shadow.js
/** @constructor */
function ShadowJS() {};
ShadowJS.prototype.NEGATIVE_INFINITY;
ShadowJS.prototype.NaN;
ShadowJS.prototype.POSITIVE_INFINITY;
ShadowJS.prototype.Server;
ShadowJS.prototype.ceilingEntry;
ShadowJS.prototype.cleanup;
ShadowJS.prototype.client;
ShadowJS.prototype.createConnection;
ShadowJS.prototype.createServer;
ShadowJS.prototype.dirname;
ShadowJS.prototype.env;
ShadowJS.prototype.execSync;
ShadowJS.prototype.existsSync;
ShadowJS.prototype.exit;
ShadowJS.prototype.floorEntry;
ShadowJS.prototype.fromCharCode;
ShadowJS.prototype.generate;
ShadowJS.prototype.gray;
ShadowJS.prototype.join;
ShadowJS.prototype.listen;
ShadowJS.prototype.on;
ShadowJS.prototype.readFileSync;
ShadowJS.prototype.static$;
ShadowJS.prototype.unbounded_unshift;
ShadowJS.prototype.writeFileSync;
ShadowJS.prototype.yellow;=>>
I get
1 | (ns calva.fmt.formatter
-------^------------------------------------------------------------------------
Invalid :refer, var ysera.test/is= does not exist
--------------------------------------------------------------------------------
2 | (:require
3 | [ysera.test :refer [is= is is-not]]
4 | [cljfmt.core :as cljfmt]))
It is a cljc
file and seems to work fine in the clj-repl
. I’m trying to use Ysera 1.2.0: https://github.com/tomas81508/ysera/blob/master/src/ysera/test.cljc@pez is=
is a macro and the file does not have :require-macros
so you need to [ysera.test :include-macros true :refer [is= is is-not]]
@thheller thanks! It now compiles. I am using it so that I can embed tests with function definitions w/o conditional readers and such.
(defmacro deftest [name & body]
`(if-cljs
(println "Not implemented.")
(clojure.test/deftest ~name ~@body)))
As for CLJS compatibility, I know that the devs behind Ysera are using it in a rather large CLJS project, but probably also there it is mostly used in order to embed tests.
this might be a question for the beginner's channel, but is there a way to include a namespace's functions globally for use in the repl? For context I want to use debux's functions without requiring the macros in each file
I am receiving this today from a node-test
build:
========= Running Tests =======================
Error: ENOENT: no such file or directory, open '/home/arichiardi/git/laputa/lambda-cqrs/.cljs-tests/cljs-runtime/goog.debug.error.js'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at global.SHADOW_IMPORT (/home/arichiardi/git/laputa/lambda-cqrs/out/tests.js:46:15)
at /home/arichiardi/git/laputa/lambda-cqrs/out/tests.js:3005:1
at Object.<anonymous> (/home/arichiardi/git/laputa/lambda-cqrs/out/tests.js:3146:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
===============================================
[:test] Build completed. (141 files, 81 compiled, 0 warnings, 16.27s)
@thheller it seems to exist no, before it did not, I have a different error now
========= Running Tests =======================
SHADOW import error /home/arichiardi/git/laputa/lambda-cqrs/.cljs-tests/cljs-runtime/ep_cloud.commit_event.js
can it be a compilation error not displayed?
let me try to compile
========= Running Tests =======================
SHADOW import error /home/arichiardi/git/laputa/lambda-cqrs/.cljs-tests/cljs-runtime/ep_cloud.commit_event.js
===============================================
[:test] Build completed. (141 files, 9 compiled, 0 warnings, 6.17s)
no other output
yeah I do know I am not executing with node
node .cljs-tests/tests.js
SHADOW import error /home/arichiardi/git/laputa/lambda-cqrs/.shadow-cljs/builds/test/dev/out/cljs-runtime/ep_cloud.commit_event.js
no other output
I'm looking at the doc for shadow.repl and when I try to do the "(require 'shadow.repl-demo)" it cannot find that namespace. Where is that? It does not appear to be in the shadow-cljs-2.4.8.jar.
@brown131 what do you want with shadow.repl
? thats an old thing which isn't really relevant anymore
I would like to be able to set breakpoints in functions in the code and then call the functions in the repl and have them hit those breakpoints, analogous to what can be done with Clojure.
@thheller I see the error in the catch, and it is some runtime error
now, the catch shows "import error" then throws
but I only see the result of console.error("SHADOW import error", filePath);
definitely weird I don't see the error, something must be wrapping it
this prints:
// the comment is for source-map-support which unfortunately shows the wrong piece of code but the stack is correct
try {
/* ignore this, look at stacktrace */ fn.call(global, require, module, __filename, __dirname);
} catch (e) {
console.error("SHADOW import error", filePath);
console.error(e);
throw e;
}
Trying to answer my own question, it appears that I should start a shadow watch then run a remote nREPL to connect.
@richiardiandrea wonder where the throw e
ends up? or the console.error(e)
?
@thheller me too 😄 but the throw
is top level...there a couple of FFE on the top
@thheller there is no console.error(e)
, I added it
should I PR that? I know not nice, but cannot understand where the exception ends up, after`throw` the debugger just exits
@thheller I just realized now, but I'm not seeing the error HUD anymore, when the compilation fails it just prints something weird in the console and the HUD loader goes away, I remember now that there was a big error display covering the screen before
now that I notice, it seems like it was this way for some time, I'm talking about errors like compilation failures (missing parentesis or something)
error example:
failed to parse websocket message {:type :build-failure, :build-config {:target :browser, :output-dir "resources/public/js/workspaces", :asset-path "/js/workspaces", :compiler-options {:closure-output-charset "US-ASCII"}, :dev {:closure-defines {common-cljs.config/dev? true}}, :devtools {:preloads [devtools.preload fulcro.inspect.preload], :before-load nubank.cljs.workspaces.core/before-load, :after-load nubank.cljs.workspaces.core/after-load}, :modules {:main {:entries [nubank.shuffle.workspaces]}}, :build-id :workspaces}, :report "------ ERROR -------------------------------------------------------------------\n File: /Users/wilkerlucio/Development/nubank/shuffle/workspaces/nubank/shuffle/common/logic/misc_ws.cljs:9:40\n--------------------------------------------------------------------------------\n 6 | (ws/deftest test-capitalize-words\n 7 | (assertions\n 8 | (misc/capitalize-words \"hello world\") => \"Hello World\"\n 9 | (misc/capitalize-words \"\") => \"\")))\n----------------------------------------------^---------------------------------\nnubank/shuffle/common/logic/misc_ws.cljs [line 9, col 40] Unmatched delimiter ).\n\n--------------------------------------------------------------------------------\n 10 | \n 11 | (ws/deftest test-index-of\n 12 | (assertions\n 13 | (misc/index-of #{:b} [:a :b :c]) => 1\n--------------------------------------------------------------------------------\n", :e clojure.lang.ExceptionInfo: failed to compile resource: [:shadow.build.classpath/resource "nubank/shuffle/common/logic/misc_ws.cljs"] {:ex-kind :reader-error, :source-excerpt {:start-idx 5, :before ["(ws/deftest test-capitalize-words" " (assertions" " (misc/capitalize-words \"hello world\") => \"Hello World\""], :line " (misc/capitalize-words \"\") => \"\")))", :after ["" "(ws/deftest test-index-of" " (assertions" " (misc/index-of #{:b} [:a :b :c]) => 1"]}, :file #object[java.io.File 0x6178a54c "/Users/wilkerlucio/Development/nubank/shuffle/workspaces/nubank/shuffle/common/logic/misc_ws.cljs"], :resource-id [:shadow.build.classpath/resource "nubank/shuffle/common/logic/misc_ws.cljs"], :ex-type :reader-exception, :column 40, :line 9, :url #object[java.net.URL 0x6fbf5713 "file:/Users/wilkerlucio/Development/nubank/shuffle/workspaces/nubank/shuffle/common/logic/misc_ws.cljs"], :source-id [:shadow.build.classpath/resource "nubank/shuffle/common/logic/misc_ws.cljs"], :tag :shadow.build.compiler/compile-cljs}} #error {:message "Invalid symbol: cloj … lang.ExceptionInfo:.", :data {:type :reader-exception, :ex-kind :reader-error}}
shadow$cljs$devtools$client$env$process_ws_msg @ env.cljs:150
(anonymous) @ browser.cljs:318
(logged as warn in console)
@thheller I am an idiot, I forgot I had an uncaught exception handler registered
@wilkerlucio hmm weird. thought I fixed that. it fails reading the :file
and :url
#object
literals
I'm on 2.5.7
the fix was after that?
question, I have a server
running, and I do watch :test
in another terminal, is it expected that I see the console logs in the server
terminal?
what do you think about adding these helpers to node-test
? It is even more important to have them in shadow
because of the different classpath approach
-n, --namespace SYMBOL Symbol indicating a specific namespace to test.
-r, --namespace-regex REGEX .*\-test$ Regex for namespaces to test. Only namespaces ending in '-test' are evaluated by default.
-v, --var SYMBOL Symbol indicating the fully qualified name of a specific test.
-i, --include SYMBOL Run only tests that have this metadata keyword.
-e, --exclude SYMBOL Exclude tests with this metadata keyword.
or a subset
say I have integration tests, I don't have an easy way to exclude them in "normal" tests cause :ns-regexp
is only inclusive
will open an issue for now- yep I was checking that
Hey folks, has anybody gotten @material design react components working with shadow-cljs?
return (
<button
className={classes}
ref={initRipple}
{...otherProps}
>
{icon ? this.renderIcon() : null}
{children}
</button>
);
Aaah. Any way to do that?
How about with the non-react version:
I get ExceptionInfo: module without entry or suffix: @material/button
Nevermind, no javascript in that...
Is there a way to load sass into the app, possibly with sass4clj?
It does seem like the examples/babel
project does the jsx stuff, but it may be broken. I get errors about the default
on the export default MyDefaultComponent
and then it gets stuck on react's default statement.
the babel example is meant for project code outside node_modules
since that is treated differently
is there an example anywhere that shows building a cljs/node AWS lambda artifact using shadow?
@steveb8n not doing exactly that, but you would build the JS with :node-script
and then zip everything up (`node_modules` included)