This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Does anybody here have experience with running cljs code in jest runner? I want to import code from my cljs app to run in my js testing project. I have compiled the cljs module with
:routes {:target :node-library
:output-to "ui-tests/lib.js"
:exports {:hello test.routes/hello}}
I can execute it using node
node
Welcome to Node.js v16.15.0.
Type ".help" for more information.
> var x = require("./lib")
undefined
> x
{ hello: [Getter] }
> x.hello
'hello from cljs'
>
But importing the code from my test.js (running using jest) i get the following error:
● Test suite failed to run
ReferenceError: goog is not defined
at .shadow-cljs/builds/routes/dev/out/cljs-runtime/goog/debug/error.js:1:1
at call (ui-tests/lib.js:70:44)
at SHADOW_IMPORT (ui-tests/lib.js:1357:1)
at factory (ui-tests/lib.js:5:26)
at Object.<anonymous> (ui-tests/lib.js:9:2)
at Object.require (ui-tests/layout.test.js:7:11)
Jest is configured using puppeteer
module.exports = {
preset: "jest-puppeteer",
testRegex: "/ui-tests/.*test\\.js$",
};