bensu / cljs-react-test

A ClojureScript wrapper around Reacts Test Utilities
43 stars 7 forks source link

TypeError: undefined is not an object (evaluating 'React.addons.TestUtils') #6

Open JarrodCTaylor opened 8 years ago

JarrodCTaylor commented 8 years ago

I am having some difficulty updating to the latest versions. I created a example project that demonstrates the issue.

Tests run as desired when using

[cljsjs/react-with-addons        "0.13.3-0"]
[cljs-react-test                 "0.1.3-SNAPSHOT"]

After updating dependencies to and making no other changes

[cljs-react-test                 "0.1.4-SNAPSHOT"]
[cljsjs/react-with-addons        "15.2.0-0"]
[cljsjs/react-dom                "15.2.0-0" :exclusions [cljsjs/react]]
[prismatic/dommy                 "1.1.0"]

The following error occurs

;; ======================================================================
;; Testing with Phantom:

TypeError: undefined is not an object (evaluating 'React.addons.TestUtils')

  phantomjs://code/phantom966794781240370468.js:81 in onError

Am I overlooking something?

bensu commented 8 years ago

Hi @JarrodCTaylor

Thank you for the report and the thoughtful repro case. I'll look at it soon but I suspect it is a bug.

JarrodCTaylor commented 8 years ago

Great thanks. If I can be of any assistance let me know.

ckirkendall commented 7 years ago

Any ideas on this, I am experiencing the same issue. I have a test setup that works in figwheel that uses optimization :none in browser but fails in phantom with :simple optimization.

ckirkendall commented 7 years ago

I think I found the issue, there is note about overwriting the file-min: https://github.com/cljsjs/packages/tree/master/react#testutils

JarrodCTaylor commented 7 years ago

@ckirkendall Interested to hear if you have success.

ckirkendall commented 7 years ago

@JarrodCTaylor - bingo! I got it working. I added the following to my compiler options.

:foreign-libs
  [{:provides ["cljsjs.react"]
    :file "https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-with-addons.js"
    :file-min "https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-with-addons.js"}]
bensu commented 7 years ago

Hi @ckirkendall !

Thank you for the useful answer! I'll close this issue once I point to that resource in the README.