Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.contracts by

I have a pedestal app I am working on. I have made some really helpful (at least to me) use of core.contracts in testing my clojure/clojurescript shared code (in clojure) using test.generative. When I open my code in the browser though and try to bring a namespace that makes use of core.contracts into clojurescript, I get the following error. None of the constraints I wrote actually make use of any native java types (at least I don't think). I am mostly just checking that the values of things align with what I expect in the inputs and outputs.

In my behavior.clj I have

(ns ^:shared com.samedhi.contracts.app.behavior

(:require (link: clojure.string :as string)
             (link: io.pedestal.app.messages :as msg)
             (link: clojure.zip :as z))
(:use (link: clojure.core.contracts :only [contract with-constraints)]
        (link: clojure.core.contracts.constraints :only [defconstrainedfn])
        (link: clojure.test :only [is])))

which compiles into cljs as

which throws a javascript exception at goog.require('clojure.core.contracts.constraints') when I look in the data-ui view, saying:

errorMessage: "goog.require could not find: clojure.core.contracts.constraints"
name: "clojure.core.contracts.constraints"

Is there some sort of special way I need to import things within clojurescript to use core.contracts?

BTW, I really appreciate core contracts, it is really neato. Thanks for you work.

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CCONTRACTS-2 (reported by alex+import)