Skip to content

Commit 502a8aa

Browse files
authored
Merge pull request #112 from clojure/cljs-3343/windows-tests
CLJS-3343: Fix Windows module processing tests
2 parents 4a37302 + 88ea212 commit 502a8aa

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/main/clojure/cljs/closure.clj

+6-1
Original file line numberDiff line numberDiff line change
@@ -2889,7 +2889,12 @@
28892889
(when (or ana/*verbose* (:verbose opts))
28902890
(util/debug-prn "Ignoring JS module" url "based on the file extension"))
28912891
(assoc js :source ""))
2892-
(assoc js :source (deps/-source js opts))))))
2892+
(if-let [src (deps/-source js opts)]
2893+
(assoc js :source src)
2894+
(throw
2895+
(ex-info (str "Could not get source for JS module")
2896+
{:js-module lib
2897+
:clojure.error/phase :compilation})))))))
28932898
(map (fn [js]
28942899
(if (:preprocess js)
28952900
(preprocess-js js opts)

src/test/clojure/cljs/module_processing_tests.clj

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
(defn preprocess-jsx [ijs _]
2424
(assoc ijs :source (clojure.string/replace
2525
(:source ijs)
26-
(re-pattern (str "\\(\n"
27-
"\\s*<svg width=\"200px\" height=\"200px\" className=\"center\">\n"
28-
"\\s*<circle cx=\"100px\" cy=\"100px\" r=\"100px\" fill=\\{this.props.color\\}>\n"
29-
"\\s*</circle>\n"
30-
"\\s*</svg>\n"
26+
(re-pattern (str "\\(\\R"
27+
"\\s*<svg width=\"200px\" height=\"200px\" className=\"center\">\\R"
28+
"\\s*<circle cx=\"100px\" cy=\"100px\" r=\"100px\" fill=\\{this.props.color\\}>\\R"
29+
"\\s*</circle>\\R"
30+
"\\s*</svg>\\R"
3131
"\\s*\\)"))
3232
(str " React.createElement(\"svg\", {width:\"200px\", height:\"200px\", className:\"center\"}, "
3333
"React.createElement(\"circle\", {cx:\"100px\", cy:\"100px\", r:\"100px\", fill:this.props.color})"

0 commit comments

Comments
 (0)