cemerick / clojurescript.test

A maximal port of `clojure.test` to ClojureScript. DEPRECATED
165 stars 32 forks source link

Can't find variable: cemerick #73

Closed dagda1 closed 9 years ago

dagda1 commented 10 years ago

This is very similar to #68

I was referencing com.cemerick/clojurescript.test "0.3.1 and I rolled back to 0.3.0.

I then had to update my test-commands to include the ```goog/base.js" file:

    :test-commands {"unit" ["phantomjs" :runner
                                      "resources/public/js/goog/base.js"
                                      "test/cljs/polyfills/bind.js"
                                      "this.literal_js_was_evaluated=true"
                                      "target/unit-test.js"]}

I now get this error:

SyntaxError: Parse error

ReferenceError: Can't find variable: cemerick

  phantomjs://webpage.evaluate():2
  phantomjs://webpage.evaluate():5
  phantomjs://webpage.evaluate():5
ReferenceError: Can't find variable: cemerick

  phantomjs://webpage.evaluate():2
  phantomjs://webpage.evaluate():8
  phantomjs://webpage.evaluate():8

Do I need to add another file to test-commands and if so, which file?

dagda1 commented 10 years ago

If I look at the generated unit-test.js file:

goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.array', 'goog.object', 'goog.string.StringBuffer']);
goog.addDependency("../clojure/string.js", ['clojure.string'], ['cljs.core', 'goog.string', 'goog.string.StringBuffer']);
goog.addDependency("../cemerick/cljs/test.js", ['cemerick.cljs.test'], ['cljs.core', 'clojure.string']);
goog.addDependency("../test/ical.js", ['test.ical'], ['cljs.core', 'cemerick.cljs.test']);
goog.addDependency("../reagent/debug.js", ['reagent.debug'], ['cljs.core']);
goog.addDependency("../reagent/impl/reactimport.js", ['reagent.impl.reactimport'], ['cljs.core']);
goog.addDependency("../reagent/impl/util.js", ['reagent.impl.util'], ['cljs.core', 'reagent.debug', 'clojure.string', 'reagent.impl.reactimport']);
goog.addDependency("../reagent/ratom.js", ['reagent.ratom'], ['cljs.core']);
goog.addDependency("../reagent/impl/batching.js", ['reagent.impl.batching'], ['cljs.core', 'reagent.debug', 'clojure.string', 'reagent.impl.util', 'reagent.ratom']);
goog.addDependency("../reagent/impl/component.js", ['reagent.impl.component'], ['cljs.core', 'reagent.debug', 'reagent.impl.util', 'reagent.impl.batching', 'reagent.ratom']);
goog.addDependency("../reagent/impl/template.js", ['reagent.impl.template'], ['cljs.core', 'reagent.debug', 'clojure.string', 'reagent.impl.component', 'reagent.impl.util', 'reagent.impl.batching', 'reagent.ratom']);
goog.addDependency("../reagent/core.js", ['reagent.core'], ['reagent.impl.template', 'cljs.core', 'reagent.impl.component', 'reagent.impl.util', 'reagent.impl.batching', 'reagent.ratom']);
goog.addDependency("../i_cal/core.js", ['i_cal.core'], ['cljs.core', 'reagent.core']);

The cemerick test files folder is not there:

cemerick

cemerick commented 10 years ago

Are you using :optimizations :none? If so, I'd suggest using :simple or :whitespace at a minimum, just so you can have a single JS file to load and not have to worry about loading goog base, etc.

dagda1 commented 10 years ago

Thanks for the response.

I am really struggling to get this set up.

My cljsbuild test section looks like this:

{:id "test"
         :source-paths ["src"
                 "src/clj"
                 "src/cljs"
                 "test/clj"
                 "test/cljs"
                 "test/cljs/ic_cal"]
         :compiler {
           :pretty-print true
           :preamble ["react/react.min.js"]
           :externs ["react/externs/react.js"]
           ; :libs ["public/js/drawer.js" "public/js/uuid.js" "public/js/compress.js"]
           :output-dir "target/"
           :output-to "target/ical-test.js"
           :optimizations :none}}

Am I right in saying, I should execute the tests with the following?

lein with-profile test cljsbuild test

When I execute this command, I get this output:

Running ClojureScript test: unit-tests
SyntaxError: Parse error

SyntaxError: Parse error

ReferenceError: Can't find variable: target

  phantomjs://webpage.evaluate():1
  phantomjs://webpage.evaluate():1
ReferenceError: Can't find variable: cemerick

  phantomjs://webpage.evaluate():2
  phantomjs://webpage.evaluate():5
  phantomjs://webpage.evaluate():5
ReferenceError: Can't find variable: cemerick

  phantomjs://webpage.evaluate():2
  phantomjs://webpage.evaluate():8
  phantomjs://webpage.evaluate():8

Any pointers as to what I am doing wrong would be most appreciated.

dagda1 commented 10 years ago

My test-commands section looks like this:

    :test-commands {"unit-tests" ["phantomjs" :runner
                                      "test/cljs/polyfills/bind.js"
                                      "test/cljs/polyfills/requestanimationframe.js"
                                      "target/ical-test.js"]}
mike-thompson-day8 commented 10 years ago

If you want to use :optimizations :none (see the last line of the cljsbuild fragment you supplied above) then you'll have to follow this advice: https://github.com/mike-thompson-day8/cljsbuild-none-test-seed

Alternatively, follow cemerick's advice and switch to using :optimizations :simple.

cemerick commented 9 years ago

Effectively a dupe of #75.