Skip to content

Commit

Permalink
Clojure mode tests (squint-cljs#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored Nov 27, 2023
1 parent d5078b5 commit efa4681
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,25 @@ jobs:
restore-keys: "${{ runner.os }}-deps-"

- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@9.3
uses: DeLaGuardo/setup-clojure@12.1
with:
cli: 1.10.3.1040
bb: latest

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Run tests
run: |
npm install
bb test:node
bb test:bb
bb test:clj
- name: Run library tests
if: matrix.os != 'windows-latest'
run: |
npm install --global yarn
bb test:libs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ bun.lockb
aoc.txt
aoc_3.cljs
aoc_3.mjs
libtests
4 changes: 3 additions & 1 deletion bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
:extra-paths ["test"]
:task (exec 'squint.compiler-test/run-tests)}
test:clj {:doc "Run tests in Clojure"
:task (clojure "-X:test")}}
:task (clojure "-X:test")}
test:libs {:doc "Run external library tests"
:task (t/libtests)}}
}
22 changes: 20 additions & 2 deletions bb/tasks.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns tasks
(:require
[babashka.fs :as fs]
[babashka.process :refer [shell]]
[babashka.process :as p :refer [shell]]
[cheshire.core :as json]
[node-repl-tests]
[clojure.string :as str]))
Expand Down Expand Up @@ -67,4 +67,22 @@
(node-repl-tests/run-tests {})
(test-project {}))


(defn libtests []
#_(build-squint-npm-package)
(let [dir "libtests"]
(fs/delete-tree dir)
(fs/create-dir dir)
(shell {:dir dir} "git clone https://github.com/nextjournal/clojure-mode")
(let [dir (fs/path dir "clojure-mode")
shell (partial p/shell {:dir dir})
squint-local (fs/path dir "node_modules/squint-cljs")]
(fs/create-dirs dir)
(shell "yarn install")
(fs/delete-tree squint-local)
(fs/create-dirs squint-local)
(run! #(fs/copy % squint-local) (fs/glob "." "*.{js,json}"))
(fs/copy-tree "lib" (fs/path squint-local "lib"))
(fs/copy-tree "src" (fs/path squint-local "src"))
(shell "node_modules/squint-cljs/node_cli.js" "compile")
(shell "node dist/nextjournal/clojure_mode_tests.mjs")
(println "clojure-mode tests successful!"))))

0 comments on commit efa4681

Please sign in to comment.