Skip to content

Commit 7d8ee19

Browse files
committed
remove :nodejs target, add code size tests for lite mode
1 parent d1212bd commit 7d8ee19

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

resources/lite_test.edn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
:npm-deps {:lodash "4.17.4"}
1010
:closure-warnings {:non-standard-jsdoc :off :global-this :off}
1111
:install-deps true
12-
:target :nodejs
1312
:language-out :es5
1413
:foreign-libs
1514
[{:file "src/test/cljs/calculator_global.js"

src/test/clojure/cljs/build_api_tests.clj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,22 @@
759759
(build/build (build/inputs (io/file inputs "trivial/core4.cljs")) opts cenv)
760760
(is (< (.length out-file) 32768))))
761761

762+
(deftest lite-mode-vector-code-size-ratchet
763+
(testing ":lite-mode + :elide-to-string, should cut output size for [] in 1/2"
764+
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-vector-test-out"))
765+
out-file (io/file out "main.js")
766+
{:keys [inputs opts]} {:inputs (str (io/file "src" "test" "cljs_build"))
767+
:opts {:main 'trivial.core4
768+
:output-dir out
769+
:output-to (.getPath out-file)
770+
:lite-mode true
771+
:elide-to-string true
772+
:optimizations :advanced}}
773+
cenv (env/default-compiler-env)]
774+
(test/delete-out-files out)
775+
(build/build (build/inputs (io/file inputs "trivial/core4.cljs")) opts cenv)
776+
(is (< (.length out-file) 16384)))))
777+
762778
(deftest trivial-output-size-map
763779
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-map-test-out"))
764780
out-file (io/file out "main.js")
@@ -772,6 +788,22 @@
772788
(build/build (build/inputs (io/file inputs "trivial/core5.cljs")) opts cenv)
773789
(is (< (.length out-file) 92160))))
774790

791+
(deftest lite-mode-map-code-size-ratchet
792+
(testing ":lite-mode + :elide-to-string, should cut output size for {} in 1/3"
793+
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-map-test-out"))
794+
out-file (io/file out "main.js")
795+
{:keys [inputs opts]} {:inputs (str (io/file "src" "test" "cljs_build"))
796+
:opts {:main 'trivial.core5
797+
:output-dir out
798+
:output-to (.getPath out-file)
799+
:lite-mode true
800+
:elide-to-string true
801+
:optimizations :advanced}}
802+
cenv (env/default-compiler-env)]
803+
(test/delete-out-files out)
804+
(build/build (build/inputs (io/file inputs "trivial/core5.cljs")) opts cenv)
805+
(is (< (.length out-file) 32768)))))
806+
775807
(deftest cljs-3255-nil-inputs-build
776808
(let [out (.getPath (io/file (test/tmp-dir) "3255-test-out"))
777809
out-file (io/file out "main.js")

0 commit comments

Comments
 (0)