This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-24
Channels
- # aleph (5)
- # announcements (18)
- # babashka (3)
- # babashka-sci-dev (56)
- # beginners (56)
- # biff (5)
- # calva (27)
- # cider (20)
- # clj-commons (2)
- # clj-kondo (17)
- # cljsrn (18)
- # clojure (41)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-uk (15)
- # clojured (1)
- # clojurescript (40)
- # cursive (39)
- # datahike (2)
- # datalevin (4)
- # datascript (5)
- # emacs (23)
- # events (2)
- # figwheel-main (3)
- # inf-clojure (1)
- # instaparse (23)
- # introduce-yourself (3)
- # jobs (3)
- # jobs-discuss (13)
- # joyride (1)
- # juxt (10)
- # malli (21)
- # nbb (29)
- # off-topic (18)
- # pathom (29)
- # polylith (11)
- # project-updates (1)
- # proletarian (1)
- # rdf (2)
- # re-frame (4)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (52)
- # tools-deps (57)
- # xtdb (32)
Did anyone explore Cypress + nbb yet? Can that work at all?
@U06QSF3BK perhaps..?
I did a trial, forgot about it, found it now and too ashamed to put it out in the open 😄
There are examples for puppeteer and playwright. I believe (I cannot claim) that testing is one of the cases @U04V15CAJ would like to have covered. @U06QSF3BK you should not be ashamed! can you share anything? at least in gist or something?
testing with cljs.test is covered in the docs. Node.js projects that behave like frameworks should probably be used with a JS wrapper
Buuut, it went like this • nbb is meant to run ontop of node, but the JavaScript that Cypress test is, is run in the browser • So we kinda want sci in the browser • but hey! nbb.loadString() let's try that! • um... how do I carry a string for nbb to load into the browser • wait, I think one can require("file.json") and webpack then bundles the json into the javascript bundle • neat! let's try writing a cypress preprocessor that when seeing a .cljs file, grabs the source, writes it into a source.json file, then spits out a javascript file that does uses nbb to load the code, something like
fs.writeFileSync(stubPath, `const code = require('${codePath}'); console.log(code.code); import {loadString} from \"nbb\"; loadString(code.code)`);
• then I look at that I did and go hmm....cypress runs in the browser? for browser testing I'd go with playwright + cljs.test then
hmm, from what I understand they have a Dashboard which instruments tests written as .js "modules". So maybe go with js wrapper makes sense. Although it's a bit awkward 😞
random google, but I guess the initial idea was to try do a bit different https://www.toolsqa.com/cypress/what-is-cypress/
the test script is run inside the browser, in an iframe IIRC, somehow it talks to the driver that is a node program, I guess the initial idea was to have a more direct access to stuff inside the browser, but yeah, this kinda puts the "test" in a bit awkward position, since you can only run javascript, which puts you into the "let's make everything as javascript" bundle mangle
contrasting this to stuff that talks to a browser and to a test that executes outside the browser, I guess those things used to be a bit crippled back in the day
If I remember correctly, in our company, we had cypress, but later we moved to puppeteer, because it was giving us better results. I think playwright would be our choice these days - because supporting multiple browsers.
I didn’t realize Playwright can deal with multiple browsers, that’s a real game changer for us as Cypress has been pretty limiting in that regard
etaoin (webdriver) is now also compatible with babashka: https://github.com/clj-commons/etaoin so you could also try that approach
hey, is there anything in clojurescript/SCI that wraps process initialization through nodejs? like this js lib: https://github.com/sindresorhus/open asking here as it's an intersection of clojurescipt and node, also asked on the main channel
yeah I was about to use it and thought I should check if something in clj-x exists as it will be easier to debug /read without context switching
Just checking (idk the usefulness) - has anyone written an "express-ring-adapter" or similar?
@emccue There is this: https://github.com/macchiato-framework/macchiato-core I don't think it runs out of the box with nbb, but we could try to make that work.