From 16fa6259eac1a8c58761187348789a71e776572c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 30 Nov 2021 17:22:17 +0100 Subject: [PATCH] :construction: Update docker deps and start working on test coverage. --- .gitignore | 2 ++ backend/test/app/test_helpers.clj | 1 + common/package.json | 6 ++++++ common/shadow-cljs.edn | 9 ++++++-- .../common/{data_test.clj => data_test.cljc} | 15 +++++-------- docker/devenv/Dockerfile | 4 ++-- frontend/shadow-cljs.edn | 21 +++++++++++++++---- 7 files changed, 40 insertions(+), 18 deletions(-) rename common/test/app/common/{data_test.clj => data_test.cljc} (86%) diff --git a/.gitignore b/.gitignore index d11830e81..4217d6130 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ figwheel_server.log .nrepl-port .cpcache .rebel_readline_history +.nyc_output /vendor/**/target /cd.md node_modules @@ -32,6 +33,7 @@ node_modules /docker/images/bundle* /common/.shadow-cljs /common/target +/common/coverage /.clj-kondo/.cache /bundle* /media diff --git a/backend/test/app/test_helpers.clj b/backend/test/app/test_helpers.clj index f503e5d66..9161296d1 100644 --- a/backend/test/app/test_helpers.clj +++ b/backend/test/app/test_helpers.clj @@ -57,6 +57,7 @@ :app.http/server :app.http/router :app.notifications/handler + :app.loggers.sentry/reporter :app.http.oauth/google :app.http.oauth/gitlab :app.http.oauth/github diff --git a/common/package.json b/common/package.json index 434435182..494c86655 100644 --- a/common/package.json +++ b/common/package.json @@ -6,6 +6,12 @@ "dependencies": { "luxon": "^1.27.0" }, + "scripts": { + "compile-and-watch-test": "clojure -M:dev:shadow-cljs watch test", + "compile-test": "clojure -M:dev:shadow-cljs compile test --config-merge '{:autorun false}'", + "run-test": "node target/test.js", + "test": "yarn run compile-test && yarn run run-test" + }, "devDependencies": { "source-map-support": "^0.5.19", "ws": "^7.4.6" diff --git a/common/shadow-cljs.edn b/common/shadow-cljs.edn index e6bcd7175..d7e55017c 100644 --- a/common/shadow-cljs.edn +++ b/common/shadow-cljs.edn @@ -6,12 +6,17 @@ :builds {:test {:target :node-test - :output-to "target/tests.js" + :output-to "target/test.js" + :output-dir "target/test/" :ns-regexp "^app.common.*-test$" - ;; :autorun true + :autorun true :compiler-options {:output-feature-set :es-next :output-wrapper false + :source-map true + :source-map-include-sources-content true + :source-map-detail-level :all :warnings {:fn-deprecated false}}}}} + diff --git a/common/test/app/common/data_test.clj b/common/test/app/common/data_test.cljc similarity index 86% rename from common/test/app/common/data_test.clj rename to common/test/app/common/data_test.cljc index 8a85bb97b..4cf9c661f 100644 --- a/common/test/app/common/data_test.clj +++ b/common/test/app/common/data_test.cljc @@ -10,16 +10,11 @@ [clojure.test :as t])) (t/deftest concat-vec - (t/is (= [1 2 3] - (d/concat-vec [1] #{2} [3]))) - - (t/is (= [1 2] - (d/concat-vec '(1) [2]))) - - (t/is (= [1] - (d/concat-vec [1]))) - - (t/is (= [] (d/concat-vec)))) + (t/is (= [] (d/concat-vec))) + (t/is (= [1] (d/concat-vec [1]))) + (t/is (= [1] (d/concat-vec #{1}))) + (t/is (= [1 2] (d/concat-vec [1] #{2}))) + (t/is (= [1 2] (d/concat-vec '(1) [2])))) (t/deftest concat-set (t/is (= #{} (d/concat-set))) diff --git a/docker/devenv/Dockerfile b/docker/devenv/Dockerfile index 602c6aa6b..3e100a612 100644 --- a/docker/devenv/Dockerfile +++ b/docker/devenv/Dockerfile @@ -3,10 +3,10 @@ LABEL maintainer="Andrey Antukh " ARG DEBIAN_FRONTEND=noninteractive -ENV NODE_VERSION=v14.17.6 \ +ENV NODE_VERSION=v16.13.0 \ CLOJURE_VERSION=1.10.3.967 \ CLJKONDO_VERSION=2021.10.19 \ - BABASHKA_VERSION=0.6.1 \ + BABASHKA_VERSION=0.6.6 \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 diff --git a/frontend/shadow-cljs.edn b/frontend/shadow-cljs.edn index 679a30a5d..6dda88e7f 100644 --- a/frontend/shadow-cljs.edn +++ b/frontend/shadow-cljs.edn @@ -65,7 +65,20 @@ :ns-regexp "^app.*-test$" ;; :autorun true - :compiler-options - {:output-feature-set :es8 - :output-wrapper false - :warnings {:fn-deprecated false}}}}} + :release + {:compiler-options + {:pseudo-names true + :pretty-print true + :source-map true + :source-map-include-sources-content true + :source-map-detail-level :all + :optimizations :whitespace + :fn-invoke-direct true}} + + :dev + {:compiler-options + {:output-feature-set :es8 + :output-wrapper false}} + + }}} +