kaocha

rgm 2022-01-14T01:06:57.011800Z

hi all ... is there a straightforward way to mock out re-frame's globals so that I can test some non-DOM-related code in a namespace that requires re-frame? My node-based kaocha-cljs suite breaks the instant I add a test that requires a re-frame containing namespace, based on not being able to find xmlhttprequest and window. Looks like just adding the xmlhttprequest and window npms isn't helping. I'm thinking including a simple JS file that has window = {} (no var or let) would do it here.

2022-01-14T01:13:23.012100Z

Probably worth asking in #re-frame

🙏 1
rgm 2022-01-14T05:25:19.012300Z

Ok so I think I'm back to this being a kaocha q ... in #re-frame the advice is to set up a preload for stubbing in globals (see https://gist.github.com/rgm/0af06f2c35aced5079b66a79081993d2). I'm hoping I'm close, but I can't seem to get "STUBBING" to print (even with --no-capture-output), plus I'm still erroring on a missing window global in a node test run. So I'm not entirely convinced the stub is running. The error I'm getting is :message "Execution error (ReferenceError) at (<cljs repl>:1).\nwindow is not defined\n". I wouldn't expect entirely smooth sailing when window is defined as an empty JS object, but I would expect to get the next interesting error instead of this one.