Fork me on GitHub
#test-check
<
2016-09-29
>
ag17:09:28

hey guys… does anyone know why

(defspec foo-test 100 
  (prop/for-all [m (s/gen ::bool-kv)] ,,,
is failing when run in clojurescript with lein-doo in phantomjs? throws this:
ERROR in (foo-test) (clojure$test$check$generators$call_gen@file:222:20)
Uncaught exception, not in assertion.
expected: nil
  actual: #object[TypeError TypeError: null is not an object (evaluating 'generator_fn.call')]

lucasbradstreet17:09:11

@ag my work mate had a similar problem to that and it was due to not requiring something

lucasbradstreet17:09:28

I was surprised that cljsbuild didn’t warn about it

lucasbradstreet17:09:40

Your mileage may vary, but it’s worth checking

ag17:09:18

actually same code works when compiled javascript directly passed to karma (without using lein-doo)

ag17:09:25

I want to use lein-doo though

lucasbradstreet18:09:43

Are they using different compiler modes? i.e. advanced vs none?

ag18:09:46

it completely breaks with :simple.

java.lang.AssertionError: Assert failed: No file for namespace my-app.test-runner exists

ag18:09:09

with :whitespace it fails with a different error:

Error: Cannot find module 'function (f) {if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}}’

lucasbradstreet18:09:25

Seems like a require error, but I don’t know too much more

lucasbradstreet18:09:25

I think it’s quite likely not to be a doo error

lucasbradstreet18:09:33

Try requiring clojure.test.check.generators

lucasbradstreet18:09:01

Possibly shouldn’t need to, but I think it might be a bug in the cljs compiler if it’s not warning about it

ag18:09:40

still the same 😞

lucasbradstreet18:09:59

I asked my co-worker and his was clojure.test.check.properties

ag18:09:24

I do have that require

ag18:09:27

[clojure.test.check.properties :as prop]

lucasbradstreet18:09:25

OK, I’ve got nothing then 🙂

ag18:09:35

so I’m wondering if it has something to do with how I require clojure.spec.generators?

ag18:09:44

so here’s the thing to require clojure spec, in clojurescript you can either do require '[cljs.spec,,, or require '[clojure.spec,,,

ag18:09:58

but when it comes to generators it’s not that smart

ag18:09:17

you can’t do require '[clojure.spec.generators]

ag18:09:45

I found a way to include them like this [cljs.spec.impl.gen :as gen]

ag18:09:56

but maybe that’s not completely right?

ag18:09:28

but then why the same code compiled and run outside of doo works fine?