This commit is contained in:
Emlyn Corrin 2021-06-07 13:06:22 +01:00
Родитель dc69629f20
Коммит 386863a5b7
8 изменённых файлов: 75 добавлений и 47 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -7,11 +7,13 @@ pom.xml.asc
/target/
/checkouts/
/node_modules
/resources/public/cljs-out
.eastwood
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
.rebel_readline_history
.DS_Store
.#*

Просмотреть файл

@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Versions
## [Unreleased]
- Deprecate single-segment namespace
- Switch clojurescript build to Figwheel.main
## [0.1.5] - 2022-07-16
- Deprecate single-segment `same` namespace in favour of `same.core`

4
dev.cljs.edn Normal file
Просмотреть файл

@ -0,0 +1,4 @@
^{:watch-dirs ["test" "src"]
:auto-testing true
}
{:main same.core}

31
figwheel-main.edn Normal file
Просмотреть файл

@ -0,0 +1,31 @@
;; Figwheel-main configuration options see: https://figwheel.org/config-options
;; these will be overriden by the metadata config options in dev.cljs.edn build file
{
;; Set the server port https://figwheel.org/config-options#ring-server-options
;; :ring-server-options {:port 9500}
;; Change the target directory from the "target" to "resources"
;; https://figwheel.org/config-options#target-dir
:target-dir "resources"
;; Server Ring Handler (optional) https://figwheel.org/docs/ring-handler.html
;; If you want to embed a ring handler into the figwheel server, this
;; is for simple ring servers
;; :ring-handler hello_world.server/handler
;; To be able to open files in your editor from the heads up display
;; you will need to put a script on your path. This script will have
;; to take a file path and a line number ie.
;; in ~/bin/myfile-opener:
;;
;; #! /bin/sh
;; emacsclient -n +$2:$3 $1
;;
;; :open-file-command "myfile-opener"
;; if you are using emacsclient you can just use
;; :open-file-command "emacsclient"
;; Logging output gets printed to the REPL, if you want to redirect it to a file:
;; :log-file "figwheel-main.log"
}

Просмотреть файл

@ -16,57 +16,41 @@
:profiles
{:dev
{:dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/clojurescript "1.11.60"]
[org.clojure/core.rrb-vector "0.1.2"]]}
[org.clojure/clojurescript "1.11.4"]
[com.bhauman/figwheel-main "0.2.17"]
[org.slf4j/slf4j-nop "1.7.30"]
[com.bhauman/rebel-readline-cljs "0.1.4"]
[org.clojure/core.rrb-vector "0.1.2"]]
:resource-paths ["target"]
;; need to add the compiled assets to the :clean-targets
:clean-targets ^{:protect false} ["target"]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
:1.10 {:dependencies [[org.clojure/clojure "1.10.1"]]}
:1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}
:1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}
:clj-kondo {:dependencies [[clj-kondo "2022.06.22"]
[com.fasterxml.jackson.core/jackson-core "2.13.3"]]}}
:cljsbuild {:builds {:test
{:source-paths ["src" "test"]
:compiler {:output-to "target/test.js"
:source-map "target/test.js.map"
:output-dir "target/js"
:main same.test-runner
:optimizations :advanced
:checked-arrays :warn}}
:node-test
{:source-paths ["src" "test"]
:compiler {:output-to "target/test.js"
:source-map "target/test.js.map"
:output-dir "target/js"
:main same.test-runner
:optimizations :advanced
:checked-arrays :warn
:target :nodejs}}}}
:plugins [;; Nice test output
[venantius/ultra "0.6.0" :exclusions [org.clojure/core.rrb-vector]]
[org.clojure/core.rrb-vector "0.1.2"]
;; Clojurescript tests
[lein-doo "0.1.11"]
#_[venantius/ultra "0.6.0" :exclusions [org.clojure/core.rrb-vector]]
#_[org.clojure/core.rrb-vector "0.1.2"]
;; Code coverage
<<<<<<< HEAD
[lein-cloverage "1.2.4"]
=======
[lein-cloverage "1.1.2"]
>>>>>>> 31703a7 (Remove custom docs code in favour of cljdoc)
;; Code/style checks
[jonase/eastwood "1.2.4"]
[lein-cljfmt "0.8.2"]]
:middleware [ultra.plugin/middleware]
;;:middleware [ultra.plugin/middleware]
:aliases {"checks" ["do" "check" ["cljfmt" "check"] "clj-kondo" "eastwood"]
"clj-kondo" ["with-profile" "+clj-kondo" "run" "-m" "clj-kondo.main" "--lint" "src" "test"]
"tests" ["do" "with-profile" "+1.11:+1.10:+1.9:+1.8:+1.7" "test," "test" ":slow"]}
"tests" ["do" "with-profile" "+1.11:+1.10:+1.9:+1.8:+1.7" "test," "test" ":slow"]
"fig:build" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]
"fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]
"fig:test" ["run" "-m" "figwheel.main" "-co" "test.cljs.edn" "-m" "same.test-runner"]}
:release-tasks [["vcs" "assert-committed"]
["change" "version" "leiningen.release/bump-version" "release"]
@ -83,14 +67,6 @@
:test-selectors {:default (complement :slow)
:slow :slow}
:doo {:build "test"
:paths {:lumo "./node_modules/.bin/lumo"
:slimer "./node_modules/.bin/slimerjs"}
:alias {:default [:lumo]
:browsers [:chrome :chrome-canary :chrome-headless :safari]
:all [:default :planck :browsers]
:broken [:phantom :slimer :rhino :nashorn :node]}}
:cloverage {:selector [:default]
:codecov? true}

Просмотреть файл

@ -3,7 +3,7 @@
(ns same.core
"Main public API namespace."
(:require #?(:clj [clojure.test :refer [assert-expr do-report]])
#?(:clj [same.diff :refer [diff]])
#?(:clj [same.diff :as diff])
[same.compare :refer [near-zero]]
[same.ish :as ish :refer [ish]]))
@ -83,6 +83,6 @@
:expected expected# :actual (if (= 1 (count actuals#))
(first actuals#)
actuals#)
:diffs (mapv #(vector % (diff expected# %))
:diffs (mapv #(vector % (diff/diff expected# %))
actuals#)}))
result#)))

10
test.cljs.edn Normal file
Просмотреть файл

@ -0,0 +1,10 @@
^{
;; use an alternative landing page for the tests so that we don't
;; launch the application
:open-url "http://[[server-hostname]]:[[server-port]]/test.html"
;; uncomment to launch tests in a headless environment
;; you will have to figure out the path to chrome on your system
:launch-js ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "--headless" "--disable-gpu" "--repl" :open-url]
}
{:main same.test-runner}

Просмотреть файл

@ -1,11 +1,13 @@
;; Copyright (c) Microsoft Corporation. All rights reserved.
;; Licensed under the MIT License.
;; This test runner is intended to be run from the command line
(ns same.test-runner
(:require [doo.runner :refer-macros [doo-tests]]
[same-test]
(:require [figwheel.main.testing :refer [run-tests-async]]
;; require all the namespaces that you want to test
[same.core-test]
[same.diff-test]
[same.platform-test]))
(doo-tests 'same-test
'same.diff-test
'same.platform-test)
(defn -main [& _args]
(run-tests-async 5000))