test-check

ag 2016-09-29T17:32:28.000032Z

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')]

lucasbradstreet 2016-09-29T17:54:11.000035Z

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

lucasbradstreet 2016-09-29T17:54:28.000036Z

I was surprised that cljsbuild didn’t warn about it

lucasbradstreet 2016-09-29T17:54:40.000037Z

Your mileage may vary, but it’s worth checking

ag 2016-09-29T17:55:18.000038Z

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

ag 2016-09-29T17:55:25.000039Z

I want to use lein-doo though

lucasbradstreet 2016-09-29T18:05:43.000040Z

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

ag 2016-09-29T18:07:46.000042Z

it completely breaks with :simple.

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

ag 2016-09-29T18:09:09.000043Z

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()}}’

lucasbradstreet 2016-09-29T18:10:25.000044Z

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

ag 2016-09-29T18:11:35.000045Z

I have created issue https://github.com/bensu/doo/issues/118

lucasbradstreet 2016-09-29T18:13:25.000048Z

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

lucasbradstreet 2016-09-29T18:14:33.000049Z

Try requiring clojure.test.check.generators

lucasbradstreet 2016-09-29T18:15:01.000050Z

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

ag 2016-09-29T18:16:40.000052Z

still the same 😞

lucasbradstreet 2016-09-29T18:16:59.000053Z

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

ag 2016-09-29T18:17:24.000054Z

I do have that require

ag 2016-09-29T18:17:27.000055Z

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

lucasbradstreet 2016-09-29T18:18:25.000056Z

OK, I’ve got nothing then 🙂

ag 2016-09-29T18:19:35.000057Z

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

ag 2016-09-29T18:20:44.000058Z

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

ag 2016-09-29T18:20:58.000059Z

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

ag 2016-09-29T18:21:17.000060Z

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

lucasbradstreet 2016-09-29T18:21:29.000061Z

Maybe

ag 2016-09-29T18:21:45.000062Z

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

ag 2016-09-29T18:21:56.000063Z

but maybe that’s not completely right?

ag 2016-09-29T18:22:28.000064Z

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