Skip to content

Commit 79aef50

Browse files
authored
Runtime tests for Windows (#109)
* Windows runtime test GH action * fix resource->source-file * enable console print if js/print is not available in test runner
1 parent 6443518 commit 79aef50

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.github/workflows/test.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ jobs:
5454
WebKit/WebKitBuild/Release/bin/jsc builds/out-adv/core-advanced-test.js | tee test-out.txt
5555
grep -qxF '0 failures, 0 errors.' test-out.txt
5656
57+
# Runtime Tests
58+
runtime-windows-test:
59+
name: Runtime Windows Tests
60+
runs-on: windows-2019
61+
steps:
62+
- uses: actions/checkout@v2
63+
64+
- uses: DeLaGuardo/[email protected]
65+
with:
66+
cli: '1.10.1.763'
67+
68+
- name: Build tests
69+
run: clojure -M:runtime.test.build
70+
shell: powershell
71+
72+
- name: Run tests
73+
run: |
74+
node builds/out-adv/core-advanced-test.js | tee test-out.txt
75+
findstr "0 failures, 0 errors." test-out.txt
76+
shell: powershell
77+
5778
# Self-host Tests
5879
self-host-test:
5980
name: Self-host Tests

src/main/clojure/cljs/externs.clj

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
[com.google.javascript.jscomp.parsing Config$JsDocParsing]
1717
[com.google.javascript.rhino
1818
Node Token JSTypeExpression JSDocInfo$Visibility]
19-
[java.util.logging Level]))
19+
[java.util.logging Level]
20+
[java.net URL]))
2021

2122
(def ^:dynamic *ignore-var* false)
2223
(def ^:dynamic *source-file* nil)
@@ -288,9 +289,9 @@
288289
{} externs))))
289290

290291
(defn resource->source-file
291-
[resource]
292+
[^URL resource]
292293
(-> (SourceFile/builder)
293-
(.withPath (.toPath (io/file (.getPath resource))))
294+
(.withPath (.getPath resource))
294295
(.withContent (io/input-stream resource))
295296
(.build)))
296297

@@ -313,6 +314,8 @@
313314
'[clojure.pprint :refer [pprint]]
314315
'[cljs.js-deps :as js-deps])
315316

317+
(resource->source-file (io/resource "goog/dom/dom.js"))
318+
316319
(pprint
317320
(get-in (analyze-goog-file "goog/dom/dom.js")
318321
[:defs 'setTextContent]))

src/test/cljs/test_runner.cljs

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
[cljs.extend-to-native-test]))
5757

5858
(set! *print-newline* false)
59-
(set-print-fn! js/print)
59+
60+
;; When testing Windows we default to Node.js
61+
(if (exists? js/print)
62+
(set-print-fn! js/print)
63+
(enable-console-print!))
6064

6165
(run-tests
6266
'cljs.apply-test

0 commit comments

Comments
 (0)