Hi!

I've been trying to get clojurescript.test working with clojurescript on nodejs.
However, I've found when I require cljs.nodejs, I end up with reference errors.
Here's the error I get:

> lein cljsbuild test
Compiling ClojureScript.
Compiling "server.js" from ["src/cljs"]...
Successfully compiled "server.js" in 12.274711 seconds.
Compiling "target/test.js" from ["src" "test"]...
Successfully compiled "target/test.js" in 4.568039 seconds.
Running ClojureScript test: unit-tests
ReferenceError: Can't find variable: require

  target/test.js:1574

Testing cljs-test.extra-test

Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
{:test 1, :pass 1, :fail 0, :error 0, :type :summary}


Here's the result commenting out the require cljs.nodejs

> lein cljsbuild test
Compiling ClojureScript.
Compiling "server.js" from ["src/cljs"]...
Successfully compiled "server.js" in 11.157378 seconds.
Compiling "target/test.js" from ["src" "test"]...
Successfully compiled "target/test.js" in 4.501921 seconds.
Running ClojureScript test: unit-tests

Testing cljs-test.extra-test

Testing cljs-test.core-test

Ran 2 tests containing 2 assertions.
0 failures, 0 errors.
{:test 2, :pass 2, :fail 0, :error 0, :type :summary}

Is this related to externs? My understanding is that I'd need to use
externs for Javascript I actually used in my code. Here I'm just requiring
cljs.nodejs: no code is actually being used.

I'd like to continue to use clojurescript.test, so any pointers
would be appreciated. I suspect I'm overlooking something simple.

I've included the relevant code below. If there's anything else I can add, 
please let me know.

Cheers,

Michael Glaesemann
grzm seespotcode net


> cat src/cljs/cljs_test/core.cljs 
(ns cljs-test.core
  ;; (:require [cljs.nodejs :as node])
  )

(defn -main [& args]
    (.log js/console (str "started at" (js/Date.))))

(set! *main-cli-fn* -main)

> cat test/cljs/cljs_test/core_test.cljs 
(ns cljs-test.core-test
  (:require-macros [cemerick.cljs.test :refer (is deftest)])
  (:require [cemerick.cljs.test :as t]
            [cljs-test.core :as core]))

(deftest core-is-core
  (is (= :core :core)))

> cat test/cljs/cljs_test/extra_test.cljs
(ns cljs-test.extra-test
  (:require-macros [cemerick.cljs.test :refer (is deftest)])
  (:require [cemerick.cljs.test :as t]))

(deftest extra-is-extra
  (is (= :extra :extra)))

(ns cljs-test.core
  (:require [cljs.nodejs :as node]))

(defn -main [& args]
  (.log js/console (str "started at " (js/Date.))))

(set! *main-cli-fn* -main)


> cat project.clj 
(defproject cljs-test "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME";
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/clojurescript "0.0-2138"]]
  :plugins [[lein-cljsbuild "1.0.1-SNAPSHOT"]
            [com.cemerick/clojurescript.test "0.2.1"]]
  :cljsbuild {:builds [{:source-paths ["src/cljs"]
                        :compiler {:output-to "server.js"
                                   :optimizations :simple
                                   :pretty-print true
                                   :externs ["externs/node.js"]
                                   :target :nodejs}}
                       {:id "test"
                        :source-paths ["src" "test"]
                        :compiler {:output-to "target/test.js"
                                   :optimizations :whitespace
                                   :pretty-print false
                                   :externs ["externs/node.js"]}}]
              :test-commands {"unit-tests" ["phantomjs" :runner
                                            
"window.literal_js_was_evaluated=true"
                                            "target/test.js"]}}
  :hooks [leiningen.cljsbuild])

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to