Skip to content

Instantly share code, notes, and snippets.

@olivergeorge
Last active October 29, 2017 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivergeorge/0e9e02eafdc2da62ca781c38d32d3bae to your computer and use it in GitHub Desktop.
Save olivergeorge/0e9e02eafdc2da62ca781c38d32d3bae to your computer and use it in GitHub Desktop.
(ns can-i-stub.main
(:require [cljs.nodejs :as nodejs]
[cljs.spec.alpha :as s]
[clojure.spec.test.alpha :as stest]))
(nodejs/enable-util-print!)
(defn add2 [a b] 10.1)
(s/fdef add2 :args (s/cat :a int? :b int?) :ret int?)
(defn -main [& args]
(println ::a (add2 1 2))
(stest/instrument `add2 {:stub #{`add2}})
(println ::b (add2 1 2))
(stest/unstrument `add2)
(println ::c (add2 1 2)))
(set! *main-cli-fn* -main)
(require 'cljs.build.api)
(cljs.build.api/build
"src"
{:main 'can-i-stub.main
:output-to "main.js"
:target :nodejs})
(defproject can-i-stub "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.9.0-beta3"]
[org.clojure/clojurescript "1.9.946"]
[org.clojure/test.check "0.9.0"]]
:jvm-opts ^:replace ["-Xmx1g" "-server"]
:plugins [[lein-npm "0.6.2"]]
:npm {:dependencies [[source-map-support "0.4.0"]]}
:source-paths ["src" "target/classes"]
:clean-targets ["out" "release"]
:target-path "target")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment