diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15204b4827..8ad7ab0029 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,7 @@ jobs: run: clojure -M:test compile test - name: Run ClojureScript query tests against basic query type - run: DB_QUERY_TYPE=basic node static/tests.js -r frontend.db.query-dsl-test + run: DB_QUERY_TYPE=basic yarn cljs:run-test -r frontend.db.query-dsl-test - name: Run ClojureScript unit tests run: yarn cljs:run-test diff --git a/.github/workflows/deps-graph-parser.yml b/.github/workflows/deps-graph-parser.yml index dc0a034f6a..19fbdc0a0f 100644 --- a/.github/workflows/deps-graph-parser.yml +++ b/.github/workflows/deps-graph-parser.yml @@ -61,26 +61,9 @@ jobs: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} - - name: Clojure cache - uses: actions/cache@v4 - id: clojure-deps - with: - path: | - ~/.m2/repository - ~/.gitlibs - key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }} - restore-keys: ${{ runner.os }}-clojure-deps- - - - name: Fetch Clojure deps - if: steps.clojure-deps.outputs.cache-hit != 'true' - run: clojure -A:test -P - - name: Fetch yarn deps run: yarn install --frozen-lockfile - - name: Run ClojureScript tests - run: clojure -M:test - - name: Run nbb-logseq tests run: yarn test diff --git a/deps/db/src/logseq/db/frontend/db_ident.cljc b/deps/db/src/logseq/db/frontend/db_ident.cljc index b681d15b2e..03e33e9a99 100644 --- a/deps/db/src/logseq/db/frontend/db_ident.cljc +++ b/deps/db/src/logseq/db/frontend/db_ident.cljc @@ -75,9 +75,9 @@ (assert (not (re-find #"^(logseq|block)(\.|$)" (name user-namespace))) "New ident is not allowed to use an internal namespace") (if #?(:org.babashka/nbb true - :cljs (exists? js/process) + ;; Use $LOGSEQ_STABLE_IDENTS when we want stable idents e.g. tests + :cljs (and (exists? js/process) js/process.env.LOGSEQ_STABLE_IDENTS) :default false) - ;; Used for contexts where we want repeatable idents e.g. tests and CLIs (keyword user-namespace (normalize-ident-name-part name-string)) (let [plugin? (string/starts-with? user-namespace "plugin.class.") suffix (str "-" diff --git a/deps/graph-parser/README.md b/deps/graph-parser/README.md index 42e37cdbb2..9a6f3ba5c9 100644 --- a/deps/graph-parser/README.md +++ b/deps/graph-parser/README.md @@ -36,10 +36,8 @@ This step is not needed if you're just running the frontend application. ### Testing -Since this library is compatible with cljs and nbb-logseq, tests are run against both languages. - -Nbb tests use [nbb-test-runner](https://github.com/nextjournal/nbb-test-runner). -Some basic usage: +Testing is done with nbb-logseq and +[nbb-test-runner](https://github.com/nextjournal/nbb-test-runner). Some basic usage: ``` # Run all tests @@ -50,13 +48,6 @@ $ yarn test -H $ yarn test -i focus ``` -ClojureScript tests use https://github.com/Olical/cljs-test-runner. To run tests: -``` -clojure -M:test -``` - -To see available options that can run specific tests or namespaces: `clojure -M:test --help` - ### Managing dependencies The package.json dependencies are just for testing and should be updated if there is diff --git a/deps/graph-parser/deps.edn b/deps/graph-parser/deps.edn index ec1b5cc6b3..8af5ee4bd2 100644 --- a/deps/graph-parser/deps.edn +++ b/deps/graph-parser/deps.edn @@ -15,14 +15,5 @@ :git/sha "30328a045141717aadbbb693465aed55f0904976"}} :aliases - ;; This runs tests with nodejs. Would be nice to run this with in a browser env - ;; since this is how its normally run in the app but this requires more setup - ;; with karma, shadow-cljs.edn and headless mode on CI - {:test {:extra-paths ["test"] - :extra-deps {olical/cljs-test-runner {:mvn/version "3.8.0"} - org.clojure/clojurescript {:mvn/version "1.11.132"} - logseq/outliner {:local/root "../outliner"}} - :main-opts ["-m" "cljs-test-runner.main"]} - - :clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "2024.09.27"}} + {:clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "2024.09.27"}} :main-opts ["-m" "clj-kondo.main"]}}} diff --git a/package.json b/package.json index ef466b8d4a..499f7f70e6 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "cljs:release-app": "clojure -M:cljs release app db-worker db-worker-node inference-worker", "cljs:release-publishing": "clojure -M:cljs release app publishing", "cljs:test": "clojure -M:test compile test", - "cljs:run-test": "node static/tests.js -r '^(?!(?:logseq.db-sync.|logseq.cli.integration-test)).*' -e fix-me", + "cljs:run-test": "LOGSEQ_STABLE_IDENTS=1 node static/tests.js -r '^(?!(?:logseq.db-sync.|logseq.cli.integration-test)).*' -e fix-me", "cljs:run-integration-test": "node static/tests.js -r '^(logseq.cli.integration-test).*'", "cljs:test-no-worker": "clojure -M:test compile test-no-worker", "cljs:run-test-no-worker": "node static/tests-no-worker.js",