cemerick / clojurescript.test

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

Error: Assert failed: (instance? TestContext test-ctx) #107

Closed optevo closed 9 years ago

optevo commented 9 years ago

Hi,

Here are the 3 files needed to generate the error on my machine:

project.clj (defproject next "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "1.7.48"] [com.cemerick/clojurescript.test "0.3.3"]] :plugins [[lein-cljsbuild "1.1.0"]] :cljsbuild {:builds {:node-dev {:source-paths ["src"] :compiler {:target :nodejs :output-to "node_dev_main.js" :output-dir "out" :optimizations :none}}}})

src/next/core.cljs (ns next.core (:require-macros [cemerick.cljs.test :refer [is deftest testing done]]) (:require [cljs.nodejs :as nodejs] [cemerick.cljs.test :as t])) (nodejs/enable-util-print!) (set! main-cli-fn -main) (defn -main & args) (t/is (= 2 (+ 1 2)))

resources/node_run.js require('../out/goog/bootstrap/nodejs') require('../node_dev_main.js') require('../out/next/core') next.core._main()

Compile with: lein cljsbuild once

Execute with: node resources/node_run.js

The error generated is: Error: Assert failed: (instance? TestContext test-ctx) at Function.cemerick.cljs.test.do_report.cljs$core$IFn$_invoke$arity$2 (/Users/me/Dev/next/out/cemerick/cljs/test.js:402:8) at cemerick$cljs$test$do_report (/Users/me/Dev/next/out/cemerick/cljs/test.js:381:37) at Object. (/Users/me/Dev/next/out/next/core.js:57:30) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/Users/me/Dev/next/resources/node_run.js:3:1)

FYI, I've tried this with :advanced compilation and run the bundled js; I get the same error.

optevo commented 9 years ago

After looking at the source, I saw that "is", etc must be run within the context of a deftest. This didn't appear in the error message - just the error.