Fork me on GitHub
#cljsrn
<
2017-08-02
>
pesterhazy08:08:50

do you need to include RN deps in the test bundle?

pesterhazy08:08:57

if possible, try to leave them out

danielneal08:08:31

^ yeah, I did the same, I ended up dropping all the dependencies on the react native bits and libraries in my reframe tests and just tested the subscriptions and handlers. I didn't have the stomach to figure out how to do the babel stuff...

mfikes14:08:27

react-native-externs 0.0.5 includes mechanically generated externs. Hopefully this will provide much better symbol coverage.

jeaye17:08:34

@pesterhazy It's not RN that's the issue; I found that it's one of my node deps, firebase, which is using ES6 imports.

jeaye17:08:56

Apparently those can't work on nodejs, so I'm currently trying to find where they can work, if anywhere. It might be that, like @danieleneal, I need to either remove the dep from the tests (and mock it, I guess), or use babel to transform this guy for me.

jeaye20:08:31

@danieleneal How did you manage to drop all the rn bits from your tests? Our tests include our code and our code requires rn.

vikeri17:08:22

jeaye: We have used two approaches 1. Use babel in runtime to compile es6 files 2. Mock out the requires with https://github.com/mfncooper/mockery

jeaye18:08:08

Thanks for the reply!

vikeri18:08:44

Np, good luck with the testing

danielneal11:08:16

@U4986ECDQ I've just started hitting the rn packager bug you elegantly demonstrated in your repo. Getting timeouts with my production builds 😱 What technique are you using to get around it if you don't mind me asking

jeaye19:08:31

@danieleneal :advanced optimization, to trim down the JS size, with :infer-externs to remove the need for extern files. cljs-oops for all member access.

danielneal09:08:39

oh nice - already using :advanced and cljs-oops - didn't think of using :infer-externs 🙂

jeaye20:08:57

I've seen some JS folks using a mock rn and it looks like that might be necessary.

danielneal21:08:16

It took a while. Basically made sure only the ui namespaces required any react native stuff and related libraries. So the test namespaces only required the subscriptions and handlers namespaces and didn't require any ui code. I mocked the reframe cofx and fx.

danielneal21:08:00

It worked for me because the subscriptions and handlers were the things I needed to test most

jeaye21:08:33

Man, what a mess.