-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Bring back workspace activation
- Loading branch information
PEZ
committed
Nov 7, 2024
1 parent
13f00be
commit b7f0fc1
Showing
11 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{:lint-as {test-runner.macros/deftest-async clojure.test/deftest}} | ||
{:lint-as {e2e.macros/deftest-async clojure.test/deftest}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns workspace-activate | ||
(:require [e2e.db :as db] | ||
["vscode" :as vscode])) | ||
|
||
(println "e2e-test-ws workspace activating...") | ||
|
||
;; If there is anything you want to happen in the workspace before | ||
;; the tests run, you can set things up here | ||
|
||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} | ||
(def ws-root (first vscode/workspace.workspaceFolders)) | ||
|
||
(def question 42) | ||
|
||
;; See e2e-test-ws/.joyride/src/tests/ws_ready/example_test.cljs | ||
;; for how we test that the workspace has been properly prepared | ||
|
||
;; The test runner will be waiting for this to appear in the state | ||
;; before it starts running tests | ||
(swap! db/!state assoc :ws-activated? true) | ||
|
||
(println "e2e-test-ws workspace activated.") | ||
|
||
;; E.g. when running the tests locally, you may have created files | ||
;; that you don't want to litter the git repo with. | ||
(defn clean-up! [] | ||
(println "Cleaning up e2e-tests workspace") | ||
:nothing-to-clean-up) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(ns a-test | ||
(:require [cljs.test :refer [deftest testing is]])) | ||
|
||
(deftest hello | ||
(testing "Test files can be put anywhere in the `src` directory. They just need to end in `_test.cljs`." | ||
(is (= :foo :foo)))) |
2 changes: 1 addition & 1 deletion
2
e2e-test-ws/.joyride/src/test_runner/db.cljs → e2e-test-ws/.joyride/src/e2e/db.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(ns test-runner.db | ||
(ns e2e.db | ||
(:require [cljs.test])) | ||
|
||
(def !state (atom {:running nil | ||
|
2 changes: 1 addition & 1 deletion
2
...t-ws/.joyride/src/test_runner/macros.cljs → e2e-test-ws/.joyride/src/e2e/macros.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(ns test-runner.macros) | ||
(ns e2e.macros) | ||
|
||
(defmacro deftest-async [name opts & body] | ||
(let [[opts body] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
e2e-test-ws/.joyride/src/tests/a_test.cljs → ...est-ws/.joyride/src/tests/smoke_test.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
(ns tests.a-test | ||
(ns tests.smoke-test | ||
(:require ["vscode" :as vscode] | ||
[cljs.test :refer [deftest testing is]] | ||
[promesa.core :as p] | ||
[test-runner.macros :refer [deftest-async]])) | ||
[e2e.macros :refer [deftest-async]])) | ||
|
||
(deftest hello | ||
(testing "We can test things" | ||
(is (= :foo :foo)))) | ||
(testing "We can test things sync things" | ||
(is (= :foo :foo)) | ||
(is (= 1 (count vscode/workspace.workspaceFolders))))) | ||
|
||
(deftest-async extension-activation | ||
(testing "The extension activates" | ||
(testing "The extension activates (which is an async operation)" | ||
(p/let [extension (vscode/extensions.getExtension "betterthantomorrow.paste-replaced") | ||
api (.activate extension)] | ||
(is (not= nil? (.getContextValue api)))))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(ns tests.ws-ready.example-test | ||
(:require [cljs.test :refer [deftest testing is]] | ||
["vscode" :as vscode] | ||
workspace-activate)) | ||
|
||
; No tests starts before the workspace is activated | ||
(deftest ws-activated | ||
(testing "The workspace is indeed activated" | ||
(is (= 42 workspace-activate/question)) | ||
(is (= (first vscode/workspace.workspaceFolders) workspace-activate/ws-root)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters