cljs-test-runner icon indicating copy to clipboard operation
cljs-test-runner copied to clipboard

ReferenceError: $jscomp is not defined

Open ccfontes opened this issue 4 years ago • 3 comments

deps.edn:

{:aliases
  {:test {:extra-paths ["test"]
          :extra-deps {olical/cljs-test-runner {:mvn/version "3.8.0"}}
          :main-opts ["-m" "cljs-test-runner.main" "-c" "test.cljs.edn"]}}

test.cljs.edn:

{:optimizations :none
 :pretty-print  false
 :closure-defines {goog.DEBUG true}}

Works with :simple optimizations.

Breaks like this with :whitespace optimizations:

❯ clj -M:test -x chrome-headless
Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/cljs_test_runner.gen.js:7060:530

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/cljs_test_runner.gen.js:7060:530

Breaks likes this with :none optimizations:

❯ clj -M:test -x chrome-headless
23 02 2021 17:46:39.377:WARN [web-server]: 404: /cljs-test-runner-out/goog/deps.js
23 02 2021 17:46:39.388:WARN [web-server]: 404: /cljs-test-runner-out/cljs_deps.js
23 02 2021 17:46:39.421:WARN [web-server]: 404: /cljs-test-runner-out/cljs_deps.js
Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/object-assign/index.js:4:155

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/object-assign/index.js:4:155

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react/cjs/react.production.min.js:6:378

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react/cjs/react.production.min.js:6:378

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react/cjs/react.development.js:7:42

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react/cjs/react.development.js:7:42
      at cljs-test-runner-out/node_modules/react/cjs/react.development.js:90:15

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.production.min.js:43:201

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.production.min.js:43:201

Chrome Headless 88.0.4324.182 (Mac OS 11.2.1) ERROR
  Uncaught ReferenceError: $jscomp is not defined
  at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:35:171

  ReferenceError: $jscomp is not defined
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:35:171
      at cljs-test-runner-out/node_modules/react-dom/cjs/react-dom.development.js:989:15

ccfontes avatar Feb 23 '21 09:02 ccfontes

Hmm I can't say I've ever seen this or know what the issue is, it feels more ClojureScript compiler related than this repos code.

It actually seems more related to the Google Closure Compiler: https://stackoverflow.com/questions/57458122/how-to-fix-referenceerror-cant-find-variable-jscomp-phantomjs-or-refere

It might be worth trying to pin to a slightly older Clojure / ClojureScript version too :thinking: I wonder if any breaking changes were introduced that I'm not aware of? I'll try to dig deeper into this soon, but I'm really busy for the next few days at least I'm afraid.

Olical avatar Feb 23 '21 18:02 Olical

@Olical Makes sense. I'll only have time to try i.e., pinning an older ClojureScript compiler starting with next weekend.

ccfontes avatar Mar 06 '21 13:03 ccfontes

Gave it a go with a ClojureScript version from 2018 (1.10.145) without success.

Tried :output-feature-set :es6 as well, but the situation didn't change.

By the way, this is a Reagent project.

package.json:

"dependencies": {
   "react": "17.0.1",
   "react-dom": "17.0.1"
}

Do you think we should close the ticket? On my side it's OK because I only intend to run these tests in CI, and a longer build time is not such a big concern.

ccfontes avatar Mar 13 '21 14:03 ccfontes