Skip to content

CI: CLJS Node Test Runner #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Tests
on: [push]

jobs:
# Runtime Tests
runtime-test:
name: Runtime Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: DeLaGuardo/setup-clojure@3.1
with:
tools-deps: '1.10.1.763'

- name: Build tests
run: clojure -M:cljs-test:adv

- name: Run tests
run: |
node out-adv-node/tests.js | tee test-out.txt
grep -qxF '0 failures, 0 errors.' test-out.txt
6 changes: 6 additions & 0 deletions build/node_adv.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{:main cljs.core.async.test-runner
:output-dir "out-adv-node"
:output-to "out-adv-node/tests.js"
:externs ["build/test_externs.js"]
:optimizations :advanced
:target :nodejs}
7 changes: 7 additions & 0 deletions build/node_simple.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{:main cljs.core.async.test-runner
:output-dir "out-simp-node"
:output-to "out-simp-node/tests.js"
:optimizations :simple
:static-fns true
:pretty-print true
:target :nodejs}
1 change: 1 addition & 0 deletions build/test_externs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.on = function(){};
4 changes: 3 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{org.clojure/tools.analyzer.jvm {:mvn/version "1.2.2"}}
:aliases
{:cljs-test {:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.597"}}
:extra-paths ["src/test/cljs"]}
:extra-paths ["src/main/clojure/cljs" "src/test/cljs"]}
:adv {:main-opts ["-m" "cljs.main" "-v" "-co" "build/node_adv.edn" "-c"]}
:simp {:main-opts ["-m" "cljs.main" "-v" "-co" "build/node_simple.edn" "-c"]}

;; For compile test purposes
;; clj -T:build compile
Expand Down
9 changes: 8 additions & 1 deletion src/test/cljs/cljs/core/async/test_runner.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
[cljs.core.async.timers-test]
[cljs.core.async.interop-tests]
[cljs.core.async.tests]
[cljs.core.async.runner-tests]))
[cljs.core.async.runner-tests]
[clojure.string :as string]))

(when (exists? js/process)
(.on js/process "uncaughtException"
(fn [e]
(when-not (= "Assert failed: This exception is expected\nfalse" (.-message e))
(println "TESTS FAILED TO COMPLETE:" (.-message e))))))

(run-tests
'cljs.core.async.runner-tests
Expand Down