Fork me on GitHub
#cljsrn
<
2019-10-04
>
thheller08:10:09

@jgoodhcg no idea. I don't do regular react-native development so I'm not familiar with the tooling. it might try to process the generated code via babel which is known to take a long time so maybe excluding it might help.

jgood16:10:23

Since jest runs with a release compile and the release compile generates 175 files

[:test] Build completed. (175 files, 1 compiled, 0 warnings, 30.54s)
But jest fails with a watch compile and the watch compile generates 242 files
[:test] Build completed. (242 files, 2 compiled, 0 warnings, 6.91s)
I'm curious what the difference is between the two sets of artifacts? @thheller

jgood17:10:53

What's a preload? 😕

thheller17:10:39

:preloads? meaning stuff only added to builds during development. for watch that'd be the devtools stuff

thheller17:10:28

watch might not be a good idea with jest

thheller17:10:41

might need to set :devtools {:enabled false}

jgood17:10:25

I didn't have any preloads set up for either of the two builds in this project.

:builds
 {:app
  {:target     :react-native
   :init-fn    
   :output-dir "app"
   :devtools   {:autoload true}}

  :test
  {:target     :npm-module
   :output-dir "test-out"
   :devtools   {:enabled false}}} ;; JUST added this and testing now

jgood17:10:09

Yea if I can't get this working with the next few attempts I'll just limit myself to only using release compilation for these tests.

jgood17:10:02

:devtools {:enabled false} still resulted in heap limit error

thheller17:10:57

did you look into the babel ignore?

jgood18:10:09

Not sure how to do that. The only explicit babel thing is this file babel.config.js at my project root.

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
  };
};

thheller18:10:04

.babelrc typically

thheller18:10:36

try a .babelrc with

{
    "ignore": ["*.js"]
}

in the :output-dir

jgood18:10:52

Doesn't seem to run the tests with that

test-out/time_align_mobile.handlers_test.js
  ● Test suite failed to run

    babel-jest: Babel ignores test-out/time_align_mobile.handlers_test.js - make sure to include the file in Jest's transformIgnorePatterns as well.
Maybe I should include anything with _test in the name? Or not ignore it?

thheller18:10:34

hmm yeah probably

thheller18:10:26

maybe its enough to exclude some of the bigger files only. so cljs.core.js and so on

thheller18:10:40

really no clue what kind of rewriting jest is doing

mynomoto18:10:17

@jgoodhcg I did that example using jest and I use watch but did not got the heap limit error. But my machine has 16gb of ram so that could explain why.

jgood18:10:31

I only get the heap limit when I include one of the namespaces I want to test. Machine has 32gb of ram and I've used node options to explicitly give the process up to 4.

jgood18:10:31

So it might be that I'm including some library that doesn't play well when compiled with watch.

thheller19:10:38

does it work if you just use shadow-cljs compile test?

thheller19:10:12

it shouldn't need that much memory to process a single ns, not even cljs.core

thheller19:10:32

so it probably is just running into some kind of infinite loop or so

jgood19:10:40

Interesting, compile also fails with heap limit error

jgood19:10:52

But it generates the same amount of files as release

jgood19:10:57

[:test] Build completed. (175 files, 0 compiled, 0 warnings, 4.37s)

jgood19:10:08

What's the difference between compile and release?

thheller19:10:31

compile isn't optimized, so its a regular dev build

jgood19:10:23

The repo is public btw https://github.com/jgoodhcg/time-align-mobile. If you wanted to see what the compiled code was.

thheller19:10:24

just without the REPL related things

jgood19:10:52

What could generate an infinite loop in compiled code but not released code?