Fork me on GitHub
#cljsrn
<
2016-04-05
>
drhops06:04:25

does anyone have unit testing setup in a re-natal project?

vikeri07:04:42

@drhops: Haha just entered here to ask the exact same question.

drhops08:04:42

@vikeri haha simple_smile glad i wasn’t missing something obvious

vikeri08:04:18

Some initial research got me to: You’ll want two kinds of tests: JS and Native. For JS we already have cljs.test and doo but I’m unsure how frictionless they can be used with RN. Jest or Mocha seems to be the most popular alternatives in the js community. A problem is that you have to emulate React Native with React. For Native there are heaps of options, Appium seems popular though. Not sure if this is a valid conclusion so please correct me if I’m missing something.

artemyarulin08:04:04

for unit test: Hardcore style: It is possible to run test on JavaScriptCore (this what RN on iOS is using). On Mac you can just run /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc and try run tests on it. I guess it should be possible to install it on nix systems as well. Example is core.logic which runs tests on JSC as well https://github.com/clojure/core.logic/blob/master/script/test (Github is slow currently) Casual style: Just run doo + node.js runner, with this you can even try to make IO, so kinda integration I hope somebody could give more info on UI/integration tests, I’m not aware

artemyarulin08:04:17

oh, forgot to mention - by unit tests I mean unit testing your logic, there is no way to load full RN environment to JSC binary

vikeri08:04:38

Great! Yeah the pure unit tests of functions seems very doable but the really interesting part is testing rendered components.

artemyarulin09:04:52

then I guess the good start would be figuring out how RN does it by itself. Later on just create a CLJS open source library and share it with us all simple_smile

vikeri10:04:49

Yeah for sure, the sad thing is that it does not seem to be a good consensus in the RN community. The official RN page on testing only supports iOS for example… But I’ll continue my investigations...

artemyarulin10:04:58

Could be, Android support in RN by itself is quite new

artemyarulin10:04:02

Somebody mentioned Rum here - what is the status with mobile support currently?