tag which shows status of fixtures page
5 |
6 | (defn set-style! [status-el & [style]]
7 | {:pre [status-el]}
8 | (let [class-names (str "status" (if (some? style) (str " status-" style)))]
9 | (oset! status-el "className" class-names)))
10 |
11 | (defn make-status []
12 | (let [status-el (gcall "document.createElement" "div")]
13 | (set-style! status-el)
14 | status-el))
15 |
16 | (defn create-status! [parent-el]
17 | {:pre [parent-el]}
18 | (let [status-el (make-status)]
19 | (ocall! parent-el "appendChild" status-el)
20 | status-el))
21 |
22 | (defn destroy-status! [status-el]
23 | {:pre [status-el]}
24 | (ocall! status-el "remove"))
25 |
26 | (defn set-status! [status-el text]
27 | {:pre [status-el]}
28 | (oset! status-el "textContent" text))
29 |
30 | (defn clear-status! [status-el]
31 | {:pre [status-el]}
32 | (set-status! status-el ""))
33 |
--------------------------------------------------------------------------------
/src/automation/dirac/automation/status_host.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.automation.status-host
2 | (:require [dirac.automation.helpers :as helpers]
3 | [dirac.automation.status :as status]))
4 |
5 | (defonce current-status (atom nil))
6 |
7 | (defn set-status! [text]
8 | (status/set-status! @current-status text))
9 |
10 | (defn init-status! [id]
11 | (let [status-el (status/create-status! (helpers/get-el-by-id id))]
12 | (reset! current-status status-el)
13 | (set-status! "ready to run")))
14 |
15 | (defn set-style! [style]
16 | (status/set-style! @current-status style))
17 |
--------------------------------------------------------------------------------
/src/automation/dirac/automation/test.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.automation.test)
2 |
3 | (defmacro with-captured-output [& body]
4 | `(-> (cljs.core/with-out-str ~@body)
5 | (dirac.shared.utils/strip-last-nl)
6 | (dirac.shared.utils/trim-leading-nls)))
7 |
--------------------------------------------------------------------------------
/src/background/dirac/background.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.background
2 | (:require [dirac.background.core :as core]
3 | [dirac.shared.utils :refer [runonce]]))
4 |
5 | (runonce
6 | (core/init!))
7 |
--------------------------------------------------------------------------------
/src/background/dirac/background/core.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.background.core
2 | (:require [chromex.chrome-event-channel :refer [make-chrome-event-channel]]
3 | [dirac.background.action :as action]
4 | [dirac.background.chrome :as chrome]
5 | [dirac.background.logging :refer [error info log warn]]
6 | [dirac.background.state :as state]
7 | [dirac.options.model :as options]
8 | [dirac.shared.async :refer [ {}
13 | (into (System/getenv))
14 | (into (System/getProperties))))
15 |
16 | (defn deep-merge-ignoring-nils
17 | "Recursively merges maps. If keys are not maps, the last value wins. Nils are ignored."
18 | [& vals]
19 | (let [non-nil-vals (remove nil? vals)]
20 | (if (every? map? non-nil-vals)
21 | (apply merge-with deep-merge-ignoring-nils non-nil-vals)
22 | (last non-nil-vals))))
23 |
24 | (defn remove-keys-with-nil-val [m]
25 | (into {} (remove (comp nil? second) m)))
26 |
--------------------------------------------------------------------------------
/src/devtools/dirac/devtools.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.devtools
2 | (:require [devtools.core :as devtools]
3 | [dirac.shared.utils :refer [runonce when-not-advanced-mode]]))
4 |
5 | (defn install-devtools-if-needed! []
6 | (when-not-advanced-mode
7 | (devtools/install!)))
8 |
9 | (runonce (install-devtools-if-needed!))
10 |
--------------------------------------------------------------------------------
/src/empty/readme.md:
--------------------------------------------------------------------------------
1 | This folder is intentionally left empty (no sources).
2 |
3 | It is used in project.clj to work around some unwanted cljsbuild behaviour.
--------------------------------------------------------------------------------
/src/figwheel/dirac/figwheel.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.figwheel
2 | (:require [dirac.shared.utils :refer [runonce when-not-advanced-mode when-not-dirac-test-mode]]
3 | [figwheel.client :as figwheel]))
4 |
5 | ; -------------------------------------------------------------------------------------------------------------------
6 | ; has to be included before boot
7 |
8 | (when-not-advanced-mode
9 | (when-not-dirac-test-mode
10 | (runonce
11 | (figwheel/start
12 | {;:build-id ['background 'popup]
13 | :websocket-url "ws://localhost:7100/figwheel-ws"}))))
14 |
--------------------------------------------------------------------------------
/src/home/dirac/home.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home
2 | (:require [dirac.home.locations :as locations]))
3 |
4 | (def get-home-dir-path locations/get-home-dir-path)
5 |
6 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 |
8 | (comment
9 | (get-home-dir-path)
10 | )
11 |
--------------------------------------------------------------------------------
/src/home/dirac/home/chromium.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home.chromium
2 | (:require [dirac.home.chromium.scout :as scout]
3 | [dirac.home.chromium.link :as link]
4 | [dirac.home.chromium.profiles :as profiles]
5 | [dirac.home.defaults :as defaults]
6 | [dirac.home.chromium.extra-args :as extra-args]
7 | [dirac.home.chromium.mapping :as mapping]
8 | [dirac.home.locations :as locations]))
9 |
10 | (def find-chrome-executable scout/find-chrome-executable)
11 | (def determine-chrome-version scout/determine-chrome-version)
12 |
13 | (def chromium-link-exists? link/chromium-link-exists?)
14 | (def resolve-chromium-link link/resolve-chromium-link)
15 |
16 | (def resolve-dirac-release! mapping/resolve-dirac-release!)
17 | (def try-download-releases-file-if-needed! mapping/try-download-releases-file-if-needed!)
18 |
19 | (def get-chromium-profile-dir-path profiles/get-chromium-profile-dir-path)
20 |
21 | (def read-chromium-extra-args extra-args/read-chromium-extra-args)
22 |
23 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 |
25 | (comment
26 | (find-chrome-executable)
27 | (determine-chrome-version (find-chrome-executable))
28 | (resolve-dirac-release! "81.1.4014.0" defaults/releases-file-url (locations/get-releases-file-path))
29 | (read-chromium-extra-args)
30 | )
31 |
--------------------------------------------------------------------------------
/src/home/dirac/home/chromium/extra_args.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home.chromium.extra-args
2 | (:require [dirac.home.helpers :as helpers]
3 | [dirac.home.locations :as locations]
4 | [clojure.java.io :as io])
5 | (:import (java.io File)))
6 |
7 | (def get-chromium-extra-args-file-path locations/get-chromium-extra-args-file-path)
8 |
9 | (defn read-chromium-extra-args
10 | ([] (read-chromium-extra-args (get-chromium-extra-args-file-path)))
11 | ([^File file]
12 | (let [file (io/file file)]
13 | (if (.exists file)
14 | (-> file
15 | (helpers/read-trimmed-lines)
16 | (helpers/filter-commented-lines))))))
17 |
18 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 |
20 | (comment
21 | (get-chromium-extra-args-file-path)
22 | (read-chromium-extra-args)
23 | )
24 |
--------------------------------------------------------------------------------
/src/home/dirac/home/chromium/profiles.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home.chromium.profiles
2 | (:require [dirac.home.locations :as locations]))
3 |
4 | (def get-chromium-profiles-dir-path locations/get-chromium-profiles-dir-path)
5 |
6 | (defn get-chromium-profile-dir-path [name]
7 | (locations/canonical-path (get-chromium-profiles-dir-path) name))
8 |
9 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 |
11 | (comment
12 | (get-chromium-profiles-dir-path)
13 | (get-chromium-profile-dir-path "test")
14 | )
15 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/editor.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.editor
2 | "Glues Parinfer's formatter to a CodeMirror editor"
3 | (:require [oops.core :refer [gcall gget oapply ocall oget]]))
4 |
5 | (def basic-editor-opts
6 | {:mode "clojure-parinfer"
7 | :theme "dirac"
8 | :matchBrackets true
9 | :height "auto"})
10 |
11 | (def parinfer-editor-opts
12 | basic-editor-opts)
13 |
14 | (defn create-editor! [element _key parinfer?]
15 | (let [element-id (oget element "id")
16 | cm-class (gget "CodeMirror")
17 | effective-opts (clj->js (if parinfer? parinfer-editor-opts basic-editor-opts))
18 | cm (cm-class. element effective-opts)
19 | wrapper (ocall cm "getWrapperElement")
20 | class (if parinfer? "cm-x-parinfer" "cm-x-basic")]
21 | (set! (.-id wrapper) (str "cm-" element-id))
22 | (set! (.-className wrapper) (str (.-className wrapper) " " class))
23 | (gcall "parinferCodeMirror.init" cm "smart" effective-opts)
24 | cm))
25 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/eval.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.eval
2 | (:require [clojure.java.io :as io]))
3 |
4 | (def playground-template-path "dirac/install-playground-runtime-template.js")
5 |
6 | (defn read-playground-template []
7 | (slurp (io/file (io/resource playground-template-path))))
8 |
9 | (defmacro emit-install-playground-runtime-template []
10 | (read-playground-template))
11 |
12 | (comment
13 | (read-playground-template))
14 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/info.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.info
2 | (:require [clojure.string :as string]
3 | [dirac.implant.logging :refer [error log warn]]
4 | [dirac.implant.version :refer [get-version]]
5 | [dirac.runtime.util :refer [get-browser-platform-info get-browser-version-info]] ; TODO: we should not depend on runtime here
6 | [oops.core :refer [gget oapply ocall oget oset!]]))
7 |
8 | ; -- helpers ----------------------------------------------------------------------------------------------------------------
9 |
10 | (defn make-chrome-info [tag rev]
11 | (str tag "@" (.substring rev 0 7)))
12 |
13 | ; -- versions ---------------------------------------------------------------------------------------------------------------
14 |
15 | (defn get-version-info []
16 | (str "Dirac v" (get-version)))
17 |
18 | ; -- public -----------------------------------------------------------------------------------------------------------------
19 |
20 | (defn get-info-line []
21 | (let [parts [(get-version-info)
22 | (get-browser-version-info)
23 | (get-browser-platform-info)]]
24 | (string/join ", " parts)))
25 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/intercom.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.intercom)
2 |
3 | (defmacro error-response [id & args]
4 | `(cljs.core.async/go
5 | (~'error ~@args)
6 | {:op :error
7 | :id ~id
8 | :err (apply str ~@(interpose " " args))}))
9 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/logging.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.logging
2 | (:require [dirac.logging.toolkit :refer [gen-console-log]]))
3 |
4 | ; ---------------------------------------------------------------------------------------------------------------------------
5 | ; logging - these need to be macros to preserve source location for devtools
6 |
7 | (def enabled? true)
8 | (def color "blue")
9 |
10 | (defn gen-log [method env args]
11 | (if enabled?
12 | (gen-console-log method args {:env env
13 | :bg-color color})))
14 |
15 | ; -- public api -------------------------------------------------------------------------------------------------------------
16 |
17 | (defmacro log [& args]
18 | (gen-log "log" &env args))
19 |
20 | (defmacro info [& args]
21 | (gen-log "info" &env args))
22 |
23 | (defmacro error [& args]
24 | (gen-log "error" &env args))
25 |
26 | (defmacro warn [& args]
27 | (gen-log "warn" &env args))
28 |
29 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/logging.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.logging
2 | (:require-macros [dirac.implant.logging])
3 | (:require [dirac.logging.toolkit]))
4 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/munging.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.munging
2 | (:require [clojure.string :as string]
3 | [devtools.munging :as munging]
4 | [dirac.implant.helpers :refer [get-dirac-angel]]
5 | [oops.core :refer [gcall oapply ocall oget oset!]]))
6 |
7 | (defn is-cljs-function-name? [munged-name]
8 | (or (empty? munged-name)
9 | (munging/cljs-fn-name? munged-name)))
10 |
11 | (defn ns-detector [name]
12 | (let [demunged-name (demunge name)
13 | namespace-descriptor (ocall (get-dirac-angel) "getNamespace" demunged-name)]
14 | (some? namespace-descriptor)))
15 |
16 | (defn present-function-name [munged-name & [include-ns? include-protocol-ns?]]
17 | (if (empty? munged-name)
18 | "λ"
19 | (let [present-opts {:include-ns? include-ns?
20 | :include-protocol-ns? include-protocol-ns?
21 | :silence-common-protocols? false
22 | :ns-detector ns-detector}]
23 | (munging/present-function-name munged-name present-opts))))
24 |
25 | (defn ns-to-relpath [ns ext]
26 | (str (string/replace (munge ns) \. \/) "." (name ext)))
27 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/options.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.options
2 | (:require [dirac.implant.logging :refer [error log warn]]
3 | [oops.core :refer [gcall gget oapply oget]]))
4 |
5 | (defn get-query-param [name]
6 | (gcall "Root.Runtime.queryParam" name))
7 |
8 | ; -- url param access -------------------------------------------------------------------------------------------------------
9 |
10 | (defn get-devtools-id* []
11 | (or (js/parseInt (get-query-param "devtools_id") 10) 0))
12 |
13 | (defn should-automate?* []
14 | (= (get-query-param "dirac_automate") "1"))
15 |
16 | (defn should-mock-old-extension-version?* []
17 | (= (get-query-param "mock_old_extension_version") "1"))
18 |
19 | (defn should-mock-future-extension-version?* []
20 | (= (get-query-param "mock_future_extension_version") "1"))
21 |
22 | (defn should-disable-reporter?* []
23 | (= (get-query-param "disable_reporter") "1"))
24 |
25 | ; -- memoized API -----------------------------------------------------------------------------------------------------------
26 |
27 | (def get-devtools-id (memoize get-devtools-id*))
28 | (def should-automate? (memoize should-automate?*))
29 | (def should-mock-old-extension-version? (memoize should-mock-old-extension-version?*))
30 | (def should-mock-future-extension-version? (memoize should-mock-future-extension-version?*))
31 | (def should-disable-reporter? (memoize should-disable-reporter?*))
32 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/repl.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.repl
2 | (:require [cljs.repl :refer [default-special-fns]]))
3 |
4 | (defmacro default-specials []
5 | `(vector ~@(distinct (map name (keys default-special-fns)))))
6 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/repl.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.repl
2 | (:require-macros [dirac.implant.repl :refer [default-specials]]))
3 |
4 | (def repl-specials (to-array (default-specials)))
5 | (def extra-specials #js ["dirac!" "*1" "*2" "*3" "*e"])
6 | (def all-specials (.concat repl-specials extra-specials))
7 |
8 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/version.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.version
2 | (:require [dirac.project]))
3 |
4 | (defonce version dirac.project/version)
5 |
6 | (defmacro get-version []
7 | version)
8 |
--------------------------------------------------------------------------------
/src/implant/dirac/implant/version.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.implant.version
2 | (:require-macros [dirac.implant.version :refer [get-version]])
3 | (:require [dirac.implant.options :as options]))
4 |
5 | (defonce version (cond
6 | (options/should-mock-old-extension-version?) "0.0.1"
7 | (options/should-mock-future-extension-version?) "1000.0.1"
8 | :else (get-version)))
9 |
--------------------------------------------------------------------------------
/src/logging/dirac/logging/toolkit.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.logging.toolkit
2 | "Helper namespace for requires needed by logging.toolkit macros"
3 | (:require-macros [dirac.logging.toolkit])
4 | (:require [dirac.shared.utils]
5 | [oops.core]))
6 |
--------------------------------------------------------------------------------
/src/logging/dirac/logging/utils.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.logging.utils
2 | (:require [clojure.set :refer [rename-keys]]
3 | [dirac.utils :as utils])
4 | (:import (org.apache.log4j Level)))
5 |
6 | (defn convert-config-to-logging-options [config]
7 | (-> config
8 | (select-keys [:log-out :log-level])
9 | (rename-keys {:log-out :out
10 | :log-level :level})
11 | (update :level #(if % (Level/toLevel ^String % Level/INFO)))
12 | (utils/remove-keys-with-nil-val)))
13 |
14 | (defn merge-options [& option-maps]
15 | (or (apply utils/deep-merge-ignoring-nils option-maps) {}))
16 |
--------------------------------------------------------------------------------
/src/main/dirac/main.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.main
2 | (:require [clojure.tools.logging :as log]
3 | [dirac.main.cli :as cli]
4 | [dirac.main.actions :as actions]
5 | [dirac.main.logging :as logging]
6 | [dirac.main.utils :as utils]
7 | [dirac.main.terminal :as terminal])
8 | (:gen-class))
9 |
10 | (defn exit! [config]
11 | (when-some [message (:message config)]
12 | (println message))
13 | (System/exit (or (:exit-status config) 0)))
14 |
15 | (defn dispatch! [config]
16 | (case (:command config)
17 | :exit (exit! config)
18 | :launch (actions/launch! config)
19 | :nuke (actions/nuke! config)
20 | (throw (ex-info "Unexpected command" config))))
21 |
22 | ; -- main entry point -------------------------------------------------------------------------------------------------------
23 |
24 | (defn -main [& args]
25 | (let [config (cli/parse-cli-args args)]
26 | (terminal/setup! config)
27 | (logging/setup! config)
28 | (log/trace (str "Using ANSI:" (pr-str (terminal/using-ansi?))))
29 | (log/debug (str "CLI config:\n" (utils/pp config)))
30 | (let [exit-code (dispatch! config)]
31 | (assert (or (nil? exit-code) (integer? exit-code)))
32 | (System/exit (or exit-code 0)))))
33 |
--------------------------------------------------------------------------------
/src/main/dirac/main/actions.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.main.actions
2 | (:require [dirac.main.actions.launch]
3 | [dirac.main.actions.nuke]))
4 |
5 | (def launch! dirac.main.actions.launch/launch!)
6 | (def nuke! dirac.main.actions.nuke/nuke!)
7 |
8 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 |
10 | (comment
11 | )
12 |
--------------------------------------------------------------------------------
/src/main/dirac/main/logging/format.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.main.logging.format
2 | (:require [dirac.main.terminal :refer [style]])
3 | (:import (org.apache.log4j Layout Level)
4 | (org.apache.log4j.spi LoggingEvent)))
5 |
6 | (defn level->styles [level]
7 | (case (.toString level)
8 | "ERROR" [:red]
9 | "INFO" [:default]
10 | "DEBUG" [:magenta]
11 | [:black]))
12 |
13 | (defn standard-formatter [event & [_kind]]
14 | (let [{:keys [renderedMessage level]} event
15 | style-args (level->styles level)]
16 | (str (apply style renderedMessage style-args) "\n")))
17 |
18 | (defn as-map [^LoggingEvent ev]
19 | (assoc (bean ev) :event ev))
20 |
21 | (defn create-layout-adaptor [f & args]
22 | (proxy [Layout] []
23 | (format [ev] (apply f (as-map ev) args))
24 | (ignoresThrowable [] true)))
25 |
26 | ; https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
27 | (defn standard-layout [& args]
28 | {:layout (apply create-layout-adaptor standard-formatter args)})
29 |
--------------------------------------------------------------------------------
/src/main/dirac/main/utils.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.main.utils
2 | (:require [clojure.pprint :refer [pprint]]
3 | [clojure.string :as string]
4 | [clojure.java.io :as io]))
5 |
6 | (defn pp [data & [level length]]
7 | (string/trim (with-out-str
8 | (binding [*print-level* (or level 10) ; we have to be careful here, data might contain circular references
9 | *print-length* (or length 200)
10 | clojure.pprint/*print-right-margin* 126] ; don't limit right margin
11 | (pprint data)))))
12 |
13 | (defn output* [f config args]
14 | (assert (map? config))
15 | (if-not (true? (:quiet config))
16 | (apply f args)))
17 |
18 | (defn output [config & args]
19 | (output* print config args))
20 |
21 | (defn outputln [config & args]
22 | (output* println config args))
23 |
24 | ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 |
26 | (comment
27 |
28 | )
29 |
--------------------------------------------------------------------------------
/src/nrepl-lib/dirac/nrepl_lib/common.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl-lib.common
2 | (:require [clojure.pprint :refer [pprint]]
3 | [clojure.string :as string]))
4 |
5 | (defn get-nrepl-server-url [host port]
6 | (str "nrepl://" host ":" port))
7 |
8 | (defn get-ws-url [host port]
9 | (str "ws://" host ":" port))
10 |
11 | (defn first-part [s]
12 | (first (string/split s #"-" 2)))
13 |
14 | (defn sid [thing]
15 | (str "#" (first-part (cond
16 | (map? thing) (str (:id thing))
17 | (seq? thing) (str (first thing))
18 | :else (str thing)))))
19 |
20 | (defn exit-with-error! [msg & [exit-code]]
21 | (binding [*out* *err*]
22 | (println "-----------------------------------------------------------------------------------------------------------")
23 | (println "ERROR!")
24 | (println msg)
25 | (println "-----------------------------------------------------------------------------------------------------------")
26 | (System/exit (or exit-code 1))))
27 |
28 | (defn print-warning! [& args]
29 | (binding [*out* *err*]
30 | (println "-----------------------------------------------------------------------------------------------------------")
31 | (println "WARNING!")
32 | (apply println args)
33 | (println "-----------------------------------------------------------------------------------------------------------")))
34 |
--------------------------------------------------------------------------------
/src/nrepl-lib/dirac/nrepl_lib/nrepl_protocols.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl-lib.nrepl-protocols)
2 |
3 | (defprotocol NREPLTunnelService
4 | (open-session [this])
5 | (close-session [this session])
6 | (deliver-message-to-server! [this message])
7 | (deliver-message-to-client! [this message]))
8 |
--------------------------------------------------------------------------------
/src/nrepl-lib/dirac/nrepl_lib/version.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl-lib.version
2 | (:require [dirac.project]))
3 |
4 | (def ^:dynamic version dirac.project/version)
5 |
--------------------------------------------------------------------------------
/src/nrepl/dirac/nrepl/debug.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl.debug
2 | (:require [clojure.tools.logging :as log]
3 | [cuerdas.core :as cuerdas]
4 | [dirac.utils :as utils])
5 | (:import (java.io PrintWriter StringWriter)))
6 |
7 | (def ^:dynamic *log-stack-traces* false)
8 |
9 | (defn drop-first-n-lines [n s]
10 | (->> s
11 | (cuerdas/lines)
12 | (drop n)
13 | (cuerdas/unlines)))
14 |
15 | (defn get-printed-stack-trace []
16 | (try
17 | (throw (Throwable. ""))
18 | (catch Throwable e
19 | (let [string-writer (StringWriter.)
20 | writer (PrintWriter. string-writer)]
21 | (.printStackTrace e writer)
22 | (drop-first-n-lines 3 (str string-writer))))))
23 |
24 | (defmacro log-stack-trace! []
25 | (when *log-stack-traces*
26 | `(log/debug (get-printed-stack-trace))))
27 |
28 | (defmacro log-stack-trace!! []
29 | `(log/debug (get-printed-stack-trace)))
30 |
31 | (defn pprint-session [session]
32 | (str "session #" (-> session meta :id)))
33 |
34 | (defn pprint-nrepl-message [nrepl-message]
35 | (let [modified-nrepl-message (assoc nrepl-message :session (pprint-session (:session nrepl-message)))]
36 | (utils/pp modified-nrepl-message)))
37 |
--------------------------------------------------------------------------------
/src/nrepl/dirac/nrepl/transports/debug_logging.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl.transports.debug-logging
2 | (:require [clojure.tools.logging :as log]
3 | [nrepl.transport :as nrepl-transport]
4 | [dirac.utils :as utils]
5 | [dirac.nrepl.debug :as debug])
6 | (:import (nrepl.transport Transport)))
7 |
8 | ; -- transport wrapper ------------------------------------------------------------------------------------------------------
9 |
10 | (defrecord DebugLoggingTransport [nrepl-message transport]
11 | Transport
12 | (recv [_this timeout]
13 | (nrepl-transport/recv transport timeout))
14 | (send [_this reply-message]
15 | (log/debug (str "sending raw message via nREPL transport: " transport " \n") (utils/pp reply-message))
16 | (debug/log-stack-trace!)
17 | (nrepl-transport/send transport reply-message)))
18 |
19 | ; -- public interface -------------------------------------------------------------------------------------------------------
20 |
21 | (defn make-nrepl-message-with-debug-logging [nrepl-message]
22 | (update nrepl-message :transport (partial ->DebugLoggingTransport nrepl-message)))
23 |
--------------------------------------------------------------------------------
/src/nrepl/dirac/nrepl/version.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.nrepl.version
2 | (:require [dirac.project]))
3 |
4 | (def ^:dynamic version dirac.project/version)
5 |
--------------------------------------------------------------------------------
/src/options/dirac/options.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.options
2 | (:require [dirac.options.core :as core]
3 | [dirac.shared.utils :refer [runonce]]))
4 |
5 | (runonce
6 | (core/go-init!))
7 |
--------------------------------------------------------------------------------
/src/options/dirac/options/core.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.options.core
2 | (:require [dirac.options.model :as model]
3 | [dirac.options.ui :as ui]
4 | [dirac.shared.async :refer [ :dirac.runtime/config
7 | ; see https://github.com/binaryage/dirac/blob/master/docs/configuration.md#dirac-runtime---page-specific-configuration
8 |
9 | (def config (gen-config))
10 |
11 | (dirac/set-prefs! (merge (dirac/get-prefs) config))
12 |
13 | (when-not (dirac/get-pref :suppress-preload-install)
14 | (dirac/install!))
15 |
--------------------------------------------------------------------------------
/src/runtime/dirac/runtime/tag.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.runtime.tag
2 | (:require [dirac.runtime.prefs :as prefs]
3 | [dirac.runtime.util :refer [get-browser-platform-info
4 | get-browser-version-info
5 | get-js-context-description
6 | in-node-context?]]))
7 |
8 | ; -- helpers ----------------------------------------------------------------------------------------------------------------
9 |
10 | (defn- prepare-tag-line [items]
11 | (apply str (interpose " | " items)))
12 |
13 | ; -- tag api ----------------------------------------------------------------------------------------------------------------
14 |
15 | (defn get-browser-tag-data []
16 | {:tag (prefs/pref :runtime-tag)
17 | :url (str js/location)
18 | :browser (get-browser-version-info)
19 | :platform (get-browser-platform-info)})
20 |
21 | (defn get-node-tag-data []
22 | {:tag (prefs/pref :runtime-tag)
23 | :platform (get-js-context-description)})
24 |
25 | (defn get-tag []
26 | (prepare-tag-line (if (in-node-context?)
27 | ((juxt :tag :platform) (get-node-tag-data))
28 | ((juxt :tag :url :browser :platform) (get-browser-tag-data)))))
29 |
--------------------------------------------------------------------------------
/src/settings/dirac/settings.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.settings
2 | (:require-macros [dirac.settings]))
3 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/async.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.async
2 | (:require-macros [dirac.shared.async])
3 | (:require [cljs.core.async])) ; used by macros
4 |
5 | ; ---------------------------------------------------------------------------------------------------------------------------
6 | ; mainly just a stub namespace for macros
7 |
8 | (defn set-timeout-marker! [o]
9 | (dirac.shared.async/gen-setup-timeout-marker o)
10 | true)
11 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/console.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.console
2 | (:require [goog.debug.Console]
3 | [goog.debug.Logger.Level :as level]
4 | [goog.log :as goog-log]
5 | [oops.core :refer [gcall oapply ocall ocall! oget oset!]]))
6 |
7 | ; taken from https://gist.github.com/caskolkm/39d823f5bac7051d3062
8 |
9 | (def logger (goog-log/getLogger "app"))
10 |
11 | (def levels
12 | {:severe level/SEVERE
13 | :warning level/WARNING
14 | :info level/INFO
15 | :config level/CONFIG
16 | :fine level/FINE
17 | :finer level/FINER
18 | :finest level/FINEST})
19 |
20 | (defn make-console []
21 | (js/goog.debug.Console.))
22 |
23 | (defn log-to-console! []
24 | (ocall! (make-console) "setCapturing" true))
25 |
26 | (defn set-level! [level-keyword]
27 | (let [wanted-level (get levels level-keyword (:info levels))]
28 | (ocall! logger "setLevel" wanted-level)))
29 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/cookies.cljs:
--------------------------------------------------------------------------------
1 | ; taken from https://github.com/Quantisan/cljs-cookies/blob/4963df43bd4b025f34a34be7b6b37b11fb69d278/src/cljs_cookies/core.cljs
2 | (ns dirac.shared.cookies
3 | (:refer-clojure :exclude [empty?])
4 | (:require [oops.core :refer [gcall oapply ocall ocall! oget oset!]])
5 | (:import goog.net.Cookies))
6 |
7 | (def cookies (Cookies. js/document))
8 |
9 | (defn make-key-name [k]
10 | (name k))
11 |
12 | (defn set-cookie [k v & opts]
13 | "Sets a cookie.
14 | Options:
15 | max-age -- The max age in seconds (from now). Use -1 to set a session cookie. If not provided, the default is -1 (i.e. set a session cookie).
16 | "
17 | (let [key-name (make-key-name k)]
18 | (when (ocall cookies "isValidName" key-name)
19 | (when (ocall cookies "isValidValue" v)
20 | (let [{:keys [max-age path domain secure?]} (apply hash-map opts)]
21 | (ocall! cookies "set" key-name v max-age path domain secure?))))))
22 |
23 | (defn get-cookie [k]
24 | "Returns the value for the first cookie with the given key."
25 | (let [key-name (make-key-name k)]
26 | (ocall cookies "get" key-name nil)))
27 |
28 | (defn remove-cookie [k]
29 | "Removes and expires a cookie."
30 | (let [key-name (make-key-name k)]
31 | (ocall cookies "remove" key-name)))
32 |
33 | (defn enabled?
34 | ([] (enabled? cookies))
35 | ([c] (ocall c "isEnabled")))
36 |
37 | (defn empty?
38 | ([] (empty? cookies))
39 | ([c] (ocall c "isEmpty")))
40 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/dom.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.dom
2 | (:require [clojure.string :as string]
3 | [dirac.shared.dom.shim]
4 | [dirac.shared.logging :refer [error info log warn]]
5 | [oops.core :refer [gcall gget oapply ocall oget oset!]]))
6 |
7 | ; -- DOM access -------------------------------------------------------------------------------------------------------------
8 |
9 | (defn element? [v]
10 | (instance? js/HTMLElement v))
11 |
12 | (defn query-selector
13 | ([selector] (gcall "document.querySelectorAll" selector))
14 | ([element selector] (ocall element "querySelectorAll" selector)))
15 |
16 | (defn query-selector-deep
17 | ([selector] (query-selector-deep (gget "document.body") selector))
18 | ([node selector] (gcall "diracAngel.querySelectorAllDeep" node selector)))
19 |
20 | (defn get-tag-name [el]
21 | (when-some [tag-name (oget el "?tagName")]
22 | (string/lower-case tag-name)))
23 |
24 | (defn get-class-name [el]
25 | (oget el "?className"))
26 |
27 | (defn get-children [el]
28 | (oget el "?children"))
29 |
30 | (defn get-shadow-root [el]
31 | (oget el "?shadowRoot"))
32 |
33 | (defn get-own-text-content [el]
34 | (when (empty? (get-children el))
35 | (oget el "?textContent")))
36 |
37 | (defn get-title [el]
38 | (oget el "?title"))
39 |
40 | (defn get-next-sibling [el]
41 | (oget el "nextSibling"))
42 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/dom/shim.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.dom.shim
2 | (:refer-clojure :exclude [empty next parents remove val]))
3 |
4 | ; ---------------------------------------------------------------------------------------------------------------------------
5 | ; taken from light-table
6 |
7 | (defn lazy-nl-via-item
8 | ([nl] (lazy-nl-via-item nl 0))
9 | ([nl n] (when (< n (. nl -length))
10 | (lazy-seq
11 | (cons (. nl (item n))
12 | (lazy-nl-via-item nl (inc n)))))))
13 |
14 | (extend-type js/HTMLCollection
15 | ISeqable
16 | (-seq [this] (lazy-nl-via-item this))
17 |
18 | ICounted
19 | (-count [this] (.-length this))
20 |
21 | IIndexed
22 | (-nth
23 | ([this n] (.item this n))
24 | ([this n not-found] (or (.item this n) not-found))))
25 |
26 | (extend-type js/NodeList
27 | ISeqable
28 | (-seq [this] (lazy-nl-via-item this))
29 |
30 | ICounted
31 | (-count [this] (.-length this))
32 |
33 | IIndexed
34 | (-nth
35 | ([this n] (.item this n))
36 | ([this n not-found] (or (.item this n) not-found))))
37 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/i18n.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.i18n)
2 |
3 | (def cannot-attach-help-url
4 | "https://github.com/binaryage/dirac/blob/master/docs/faq.md#getting-error-cannot-attach-dirac-devtools-what-now")
5 |
6 | (defn unable-to-create-dirac-tab []
7 | "Unable to create a new tab for Dirac DevTools.")
8 |
9 | (defn cannot-attach-dirac [debugger-url tab-url]
10 | (str "Cannot attach Dirac DevTools. "
11 | "Likely cause: another instance of DevTools is already attached.\n"
12 | "Don't you have internal DevTools open in the tab?\n"
13 | "See " cannot-attach-help-url ".\n"
14 | "tab-url=" tab-url ", debugger-url=" debugger-url))
15 |
16 | (defn unable-to-resolve-backend-url [debugger-url tab-url reason]
17 | (str "Unable to resolve backend-url for given tab-url (via debugger-url).\n"
18 | (when (some? reason) (str "reason: " reason "\n"))
19 | "tab-url=" tab-url ", debugger-url=" debugger-url))
20 |
21 | (defn debugger-url-not-specified []
22 | "Chrome debugger URL not specified. Check your Dirac options.")
23 |
24 | (defn tab-cannot-be-debugged [tab]
25 | (str "This tab cannot be debugged: it has no tab url" tab))
26 |
27 | (defn unable-to-complete-intercom-initialization [frontend-tab-id reason]
28 | (str "Unable to complete intercom initialization"
29 | (when (some? reason) (str ", reason: " reason))
30 | ". (frontend-tab-id=" frontend-tab-id ")"))
31 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/logging.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.logging
2 | (:require [dirac.logging.toolkit :refer [gen-console-log]]))
3 |
4 | ; ---------------------------------------------------------------------------------------------------------------------------
5 | ; logging - these need to be macros to preserve source location for devtools
6 |
7 | (def enabled? true)
8 | (def color "gray")
9 |
10 | (defn gen-log [method env args]
11 | (if enabled?
12 | (gen-console-log method args {:env env
13 | :bg-color color})))
14 |
15 | ; -- public api -------------------------------------------------------------------------------------------------------------
16 |
17 | (defmacro log [& args]
18 | (gen-log "log" &env args))
19 |
20 | (defmacro info [& args]
21 | (gen-log "info" &env args))
22 |
23 | (defmacro error [& args]
24 | (gen-log "error" &env args))
25 |
26 | (defmacro warn [& args]
27 | (gen-log "warn" &env args))
28 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/logging.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.logging
2 | (:require-macros [dirac.shared.logging])
3 | (:require [dirac.logging.toolkit]))
4 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/quoted_printable.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.quoted-printable
2 | (:require [oops.core :refer [gcall gget oapply ocall oget oset!]]))
3 |
4 | ; taken from
5 | ; https://github.com/mathiasbynens/quoted-printable/blob/326f631c9dd0cd051d12ab1b39682a97126b1894/src/quoted-printable.js
6 | ; by @mathias | MIT license
7 |
8 | (def re-qp-trailing-whitespace (js/RegExp. "\\s+$" "gm"))
9 | (def re-qp-hard-line-breaks (js/RegExp. "=(?:\\n|$)" "g"))
10 | (def re-qp-escaped-sequences (js/RegExp. "=([a-fA-F0-9]{2})" "g"))
11 | (def from-char-code (gget "String.fromCharCode"))
12 |
13 | (defn decode-escape-sequence [hex-code-point-str]
14 | (let [code-point (gcall "parseInt" hex-code-point-str 16)]
15 | (from-char-code code-point)))
16 |
17 | (defn decode-quoted-printable [source]
18 | (-> source
19 | (.replace re-qp-trailing-whitespace "")
20 | (.replace re-qp-hard-line-breaks "")
21 | (.replace re-qp-escaped-sequences #(decode-escape-sequence %2))))
22 |
--------------------------------------------------------------------------------
/src/shared/dirac/shared/utils.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.shared.utils
2 | (:require [cljs.env]
3 | [environ.core :as environ]))
4 |
5 | (defmacro runonce [& body]
6 | (let [code (cons 'do body)
7 | code-string (pr-str code)
8 | code-hash (hash code-string)
9 | name (symbol (str "runonce_" code-hash))]
10 | `(defonce ~name {:value ~code
11 | :code ~code-string})))
12 |
13 | (defn timeout-display [time-ms]
14 | {:pre [(number? time-ms)]}
15 | (format "%.1fs" (/ time-ms 1000.)))
16 |
17 | (defn advanced-mode? []
18 | (when (some? cljs.env/*compiler*)
19 | (= (get-in @cljs.env/*compiler* [:options :optimizations]) :advanced)))
20 |
21 | (defmacro when-advanced-mode [& body]
22 | (when (advanced-mode?)
23 | `(do ~@body)))
24 |
25 | (defmacro when-not-advanced-mode [& body]
26 | (when-not (advanced-mode?)
27 | `(do ~@body)))
28 |
29 | (defn dirac-test-mode? []
30 | (some? (:dirac-test-browser environ/env)))
31 |
32 | (defmacro when-not-dirac-test-mode [& body]
33 | (when-not (dirac-test-mode?)
34 | `(do ~@body)))
35 |
--------------------------------------------------------------------------------
/test/backend/src/backend_tests/dirac/tests/backend/agent/state.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.backend.agent.state)
2 |
3 | (def received-messages (atom []))
4 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/css/index.css:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: courier, monospace;
3 | font-size: 12px;
4 | }
5 |
6 | .tasks .tasks-title {
7 | font-weight: bold;
8 | }
9 |
10 | .tasks .suite-title {
11 | font-weight: bold;
12 | display: block;
13 | margin-bottom: 6px;
14 | margin-top: 20px;
15 | }
16 |
17 | .tasks .suite-list {
18 | margin-bottom: 16px;
19 | list-style-type: square;
20 | padding-left: 20px;
21 | }
22 |
23 | .tasks .task-list {
24 | list-style-type: decimal-leading-zero;
25 | }
26 |
27 | .scenarios .scenarios-title {
28 | font-weight: bold;
29 | }
30 |
31 | .scenarios .scenarios-list {
32 | margin-bottom: 16px;
33 | padding-left: 60px;
34 | list-style-type: decimal-leading-zero;
35 | }
36 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/css/scenario.css:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: courier;
3 | font-size: 12px;
4 | }
5 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
TASK INDEX
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/runner.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
TASK RUNNER
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
16 | run again!
17 | reset!
18 | go to index
19 | pause!
20 | resume!
21 | normalize
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/barebone.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
barebone
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | no cljs-devtools
14 | no dirac runtime support
15 | we want to test basic feedback/notification systems
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/breakpoint.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
breakpoint
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | minimalist sample project paused on a breakpoint
16 |
17 |
18 |
19 |
20 |
:pause-on-breakpoint
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/completions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
completions
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | completions workspace is present
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/core-async.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
core-async
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | core-async code with async stack traces
16 |
17 |
18 |
19 |
20 |
:async
21 |
:async-loop
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/exception.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
exception
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | minimalist sample project which can trigger an unhandled exception with non-trivial stack-trace
16 |
17 |
18 |
19 |
20 |
:cause-exception
21 |
:break
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/future-repl-api.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
future repl api
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized but repl api reports future version
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/future-runtime.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
future runtime
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized, but reports future version
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/issue-53.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
issue-53
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | issue-53 workspace is present
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/issue-55.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
issue-55
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | issue-55 workspace is present
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/issue-74.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
issue-74
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | issue-74 workspace is present
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/no-agent.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
no agent
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | This page scenario contains:
13 |
14 | cljs-devtools
15 | dirac runtime properly initialized but dirac agent is not listening
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/no-repl.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
no repl
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized but :repl feature was disabled
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/no-runtime.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
no runtime
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime is not installed
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/normal-via-preloads.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
normal via preloads
5 |
6 |
7 |
8 |
9 | This page scenario contains:
10 |
11 | dirac runtime properly initialized via preloads
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/normal-with-feedback.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
normal + feedback
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | console feedback enabled
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/normal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
normal
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/old-repl-api.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
old repl api
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized but repl api reports old version
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/old-runtime.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
old runtime
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized, but reports old version
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/repl.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
completions
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | dirac runtime properly initialized
15 | repl workspace is present
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/browser/fixtures/resources/scenarios/runtime-api.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
runtime api
5 |
6 |
7 |
8 |
9 |
10 |
11 | This page scenario contains:
12 |
13 | cljs-devtools
14 | our goal is to exercise dirac.runtime apis
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/barebone.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.barebone
2 | (:require [chromex.logging :refer-macros [log]]
3 | [dirac.automation.runtime :refer [init-runtime!]]
4 | [dirac.automation.scenario :as scenario]
5 | [dirac.shared.async :refer [ i n)
17 | (break-here!)
18 | (do
19 | ( console-output
11 | replace-versions))
12 |
13 | (init-runtime! {:future-runtime true})
14 | (scenario/capture-console-as-feedback!)
15 | (scenario/register-feedback-transformer! transformer)
16 | (scenario/go-ready!)
17 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_agent.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.no-agent
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]))
4 |
5 | ; deliberately mis-configure agent port to simulate "agent not listening on port" situation
6 | (init-runtime! {:runtime-prefs {:agent-port 9999}})
7 | (scenario/go-ready!)
8 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_repl.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.no-repl
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]))
4 |
5 | (init-runtime! {:do-not-enable-repl true})
6 | (scenario/capture-console-as-feedback!)
7 | (scenario/go-ready!)
8 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/no_runtime.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.no-runtime
2 | (:require [dirac.automation.scenario :as scenario]
3 | [dirac.automation.triggers :refer [install-common-triggers!]]))
4 |
5 | (scenario/capture-console-as-feedback!)
6 | (install-common-triggers!)
7 | (scenario/go-ready!)
8 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/normal.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.normal
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]
4 | [dirac.automation.triggers :refer [install-common-triggers!]]))
5 |
6 | (init-runtime!)
7 | (install-common-triggers!)
8 | (scenario/go-ready!)
9 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/normal_with_feedback.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.normal-with-feedback
2 | (:require [clojure.string :as string]
3 | [dirac.automation.runtime :refer [init-runtime!]]
4 | [dirac.automation.scenario :as scenario]))
5 |
6 | (defn replace-versions [s]
7 | (string/replace s #"\(v.*?\)" "**VERSION**"))
8 |
9 | (defn transformer [console-output]
10 | (-> console-output
11 | replace-versions))
12 |
13 | (init-runtime!)
14 | (scenario/capture-console-as-feedback!)
15 | (scenario/register-feedback-transformer! transformer)
16 | (scenario/go-ready!)
17 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/old_repl_api.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.old-repl-api
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]))
4 |
5 | (init-runtime! {:old-repl-api true})
6 | (scenario/capture-console-as-feedback!)
7 | (scenario/go-ready!)
8 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/old_runtime.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.old-runtime
2 | (:require [clojure.string :as string]
3 | [dirac.automation.runtime :refer [init-runtime!]]
4 | [dirac.automation.scenario :as scenario]))
5 |
6 | (defn replace-versions [s]
7 | (string/replace s #"\(v.*?\)" "**VERSION**"))
8 |
9 | (defn transformer [console-output]
10 | (-> console-output
11 | replace-versions))
12 |
13 | (init-runtime! {:old-runtime true})
14 | (scenario/capture-console-as-feedback!)
15 | (scenario/register-feedback-transformer! transformer)
16 | (scenario/go-ready!)
17 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/repl.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.repl
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]
4 | [dirac.automation.triggers :refer [install-common-triggers!]]
5 | [dirac.tests.scenarios.repl.workspace :as workspace]))
6 |
7 | (init-runtime!)
8 | (install-common-triggers!)
9 | (scenario/go-ready!)
10 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios01/dirac/tests/scenarios/repl/workspace.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.repl.workspace)
2 |
3 | (enable-console-print!)
4 |
5 | (defn hello! [s]
6 | (println (str "Hello, " (or s "World") "!")))
7 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios02/dirac/tests/scenarios/normal_via_preloads.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.normal-via-preloads
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]
4 | [dirac.runtime :as dirac-runtime]))
5 |
6 | (defn check-runtime-installed []
7 | (.log js/console (str "runtime installed? " (dirac-runtime/installed?))))
8 |
9 | (defn check-runtime-config []
10 | (.log js/console (str ":external-config-setting is '" (:external-config-setting (dirac-runtime/get-prefs)) "'")))
11 |
12 | ; note that dirac.runtime should be initialized via preloads
13 | ; see :scenarios02 build in project.clj - we use :main and :preloads there
14 | #_(init-runtime!)
15 | (scenario/capture-console-as-feedback!)
16 | (scenario/register-trigger! :check-runtime-installed check-runtime-installed)
17 | (scenario/register-trigger! :check-runtime-config check-runtime-config)
18 | (scenario/go-ready!)
19 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/completions/issue_55.cljc:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.completions.issue-55
2 | "https://github.com/binaryage/dirac/issues/55"
3 | (:require
4 | #?(:clj [dirac.settings :as ignored]
5 | :cljs [goog.object :as gobj])
6 | #?(:clj
7 | [dirac.project :refer :all]))) ; there is no such thing as :refer :all in clojurescript
8 |
9 | #?(:cljs
10 | (do
11 | (enable-console-print!)
12 | (def some-var "something")))
13 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_53.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.issue-53
2 | "https://github.com/binaryage/dirac/issues/53"
3 | (:require [dirac.automation.runtime :refer [init-runtime!]]
4 | [dirac.automation.scenario :as scenario]
5 | [dirac.automation.triggers :refer [install-common-triggers!]]
6 | [dirac.tests.scenarios.issue-53.core]))
7 |
8 | (init-runtime!)
9 | (install-common-triggers!)
10 | (scenario/go-ready!)
11 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_53/core.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.issue-53.core)
2 |
3 | (defn breakpoint-fn1 []
4 | (let [x 1]
5 | (let [y 2]
6 | (let [x 3
7 | z #(println x)]
8 | (js-debugger)))))
9 |
10 | (defn breakpoint-fn2 [one-one]
11 | (let [two-two 2]
12 | ((fn rebind [] one-one))
13 | (js-debugger)))
14 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_55.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.issue-55
2 | (:require [dirac.automation.runtime :refer [init-runtime!]]
3 | [dirac.automation.scenario :as scenario]
4 | [dirac.automation.triggers :refer [install-common-triggers!]]
5 | [dirac.tests.scenarios.completions.issue-55 :as issue-55]))
6 |
7 | (init-runtime!)
8 | (install-common-triggers!)
9 | (scenario/go-ready!)
10 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_74.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.issue-74
2 | "https://github.com/binaryage/dirac/issues/74"
3 | (:require [dirac.automation.runtime :refer [init-runtime!]]
4 | [dirac.automation.scenario :as scenario]
5 | [dirac.automation.triggers :refer [install-common-triggers!]]
6 | [dirac.tests.scenarios.issue-74.core]))
7 |
8 | (init-runtime!)
9 | (install-common-triggers!)
10 | (scenario/go-ready!)
11 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/scenarios03/dirac/tests/scenarios/issue_74/core.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.scenarios.issue-74.core)
2 |
3 | (defn fn-with-breakpoint []
4 | (let [a 42]
5 | (js-debugger)
6 | (* a 2)))
7 |
8 | (defn fn-with-async-breakpoint []
9 | (js/setTimeout fn-with-breakpoint 0)
10 | 100)
11 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/tasks/dirac/tests/tasks/helpers/open_scenario.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.tasks.helpers.open-scenario
2 | (:require [dirac.automation :refer-macros [try to reconnect in 4 seconds" (seconds 20)))))
13 |
--------------------------------------------------------------------------------
/test/browser/fixtures/src/tasks/dirac/tests/tasks/suite01/preloads.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac.tests.tasks.suite01.preloads
2 | (:require [cljs.test :refer-macros [is]]
3 | [dirac.automation :refer-macros [" into cljs url params
9 |
10 | (go-task
11 | (with-scenario "breakpoint"
12 | (testing "enabled :clean-urls feature"
13 | (with-devtools
14 | ("}
4 | extension set extension options:{:open-as "window"}
5 | automate open-scenario! ["barebone"]
6 | scenario immediate feedback
7 | automate trigger! [:test-trigger]
8 | scenario feedback from trigger
9 | automate close-scenario! ["scenario-tab#1"]
10 | summary Automated 3 actions with 2 check-points containing 0 assertions.
11 | 0 failures, 0 errors.
12 |
--------------------------------------------------------------------------------
/test/browser/transcripts/expected/suite01-misc.txt:
--------------------------------------------------------------------------------
1 | ns Testing dirac.tests.tasks.suite01.misc
2 | extension reset extension state
3 | extension set extension options:{:target-url "http://localhost:
"}
4 | extension set extension options:{:open-as "window"}
5 | automate open-scenario! ["normal"]
6 | automate close-scenario! ["scenario-tab#1"]
7 | summary Automated 2 actions with 0 check-points containing 0 assertions.
8 | 0 failures, 0 errors.
9 |
--------------------------------------------------------------------------------
/test/browser/transcripts/expected/suite01-preloads.txt:
--------------------------------------------------------------------------------
1 | ns Testing dirac.tests.tasks.suite01.preloads
2 | extension reset extension state
3 | extension set extension options:{:target-url "http://localhost:"}
4 | extension set extension options:{:open-as "window"}
5 | automate open-scenario! ["normal-via-preloads"]
6 | automate trigger! [:check-runtime-installed]
7 | scenario out LOG: ("runtime installed? true")
8 | automate trigger! [:check-runtime-config]
9 | scenario out LOG: (":external-config-setting is 'configured externally'")
10 | automate close-scenario! ["scenario-tab#1"]
11 | summary Automated 4 actions with 2 check-points containing 0 assertions.
12 | 0 failures, 0 errors.
13 |
--------------------------------------------------------------------------------
/test/dirac/home/chromium/scout_test.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home.chromium.scout-test
2 | (:require [clojure.test :refer :all]
3 | [matcher-combinators.test :refer :all]
4 | [matcher-combinators.matchers :as m]
5 | [dirac.home.chromium.scout :refer [parse-chrome-version-string]]))
6 |
7 | (deftest parse-chrome-version-string-test
8 | (testing "parsing chrome executable version"
9 | (is (match? {:version "80.0.3968.0" :prefix "Google Chrome" :postfix "canary"}
10 | (parse-chrome-version-string "Google Chrome 80.0.3968.0 canary")))
11 | (is (match? {:version "80.0.3968.0" :prefix "Google Chrome" :postfix nil}
12 | (parse-chrome-version-string "Google Chrome 80.0.3968.0")))
13 | (is (match? {:version "80.0.3968.0" :prefix "Something" :postfix nil}
14 | (parse-chrome-version-string "Something 80.0.3968.0")))
15 | (is (match? {:version "80.0.3968.0" :prefix nil :postfix nil}
16 | (parse-chrome-version-string "80.0.3968.0")))
17 | (is (match? nil
18 | (parse-chrome-version-string "")))
19 | ))
20 |
21 | (comment
22 | (run-tests))
23 |
24 |
--------------------------------------------------------------------------------
/test/dirac/home/locations_test.clj:
--------------------------------------------------------------------------------
1 | (ns dirac.home.locations-test
2 | (:require [clojure.test :refer :all])
3 | (:require [dirac.home.helpers :as helpers]
4 | [dirac.home.locations :refer [resolve-home-dir]]))
5 |
6 | (defn make-mock-system-get-property [user-home-dir]
7 | (fn [name]
8 | (case name
9 | "user.home" user-home-dir)))
10 |
11 | (defn make-mock-system-get-env-empty []
12 | (fn [_name]))
13 |
14 | (defn make-mock-system-get-env-dirac-home [dirac-home-dir]
15 | (fn [name]
16 | (case name
17 | "DIRAC_HOME" dirac-home-dir)))
18 |
19 | ; note: this tests will probably fail under windows
20 | (deftest resolve-home-dir-test
21 | (binding [helpers/*system-get-property-impl* (make-mock-system-get-property "/some/home")
22 | helpers/*system-get-env-impl* (make-mock-system-get-env-empty)]
23 | (is (= (resolve-home-dir) "/some/home/.dirac")))
24 | (binding [helpers/*system-get-property-impl* (make-mock-system-get-property "/some/home")
25 | helpers/*system-get-env-impl* (make-mock-system-get-env-dirac-home "/explicit/dirac/home")]
26 | (is (= (resolve-home-dir) "/explicit/dirac/home"))))
27 |
28 | (comment
29 | (run-tests))
30 |
--------------------------------------------------------------------------------
/test/gpig/.gitignore:
--------------------------------------------------------------------------------
1 | pom.xml
2 | *jar
3 | /lib/
4 | /classes/
5 | /out/
6 | /target/
7 | .lein-deps-sum
8 | .lein-repl-history
9 | .lein-plugins/
10 | .repl
11 | .nrepl-port
12 | .cpcache/
13 | .rebel_readline_history
14 | .test-dirac-chrome-profile/
15 | .idea/
--------------------------------------------------------------------------------
/test/gpig/deps.edn:
--------------------------------------------------------------------------------
1 | {:deps {org.clojure/clojure {:mvn/version "1.10.1"}
2 | org.clojure/clojurescript {:mvn/version "1.10.520"}
3 | cljsjs/react {:mvn/version "16.9.0-0"}
4 | cljsjs/react-dom {:mvn/version "16.9.0-0"}
5 | cljsjs/create-react-class {:mvn/version "15.6.3-1"}
6 | sablono {:mvn/version "0.8.6"}
7 | ;binaryage/dirac {:mvn/version "1.4.0}
8 | binaryage/dirac {:local/root "/Users/darwin/code/dirac-ws/dirac"}
9 |
10 | ; REPL
11 | com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
12 | com.bhauman/figwheel-main {:mvn/version "0.2.3"}
13 | nrepl {:mvn/version "0.6.0"}
14 |
15 | ; logging
16 | clj-logging-config {:mvn/version "1.9.12"}
17 | org.slf4j/slf4j-log4j12 {:mvn/version "1.7.28"}
18 |
19 | }
20 | :paths ["src/main"
21 | "src/repl"
22 |
23 | "test"
24 |
25 | "resources"
26 | "target"]
27 | :aliases {:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
28 | :min {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
29 | :test {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" dirac-gpig.test-runner]}}}
30 |
--------------------------------------------------------------------------------
/test/gpig/dev.cljs.edn:
--------------------------------------------------------------------------------
1 | ^{:watch-dirs ["test" "src/main"]
2 | :css-dirs ["resources/public/css"]
3 | :auto-testing true}
4 | {:main dirac-gpig.core
5 | :preloads [dirac.runtime.preload]
6 | :external-config {:dirac.runtime/config {:nrepl-config {:preferred-compiler "figwheel"}}}
7 | }
8 |
--------------------------------------------------------------------------------
/test/gpig/figwheel-main.edn:
--------------------------------------------------------------------------------
1 | ;; Figwheel-main configuration options see: https://figwheel.org/config-options
2 | ;; these will be overriden by the metadata config options in dev.cljs.edn build file
3 | {
4 | ;; Set the server port https://figwheel.org/config-options#ring-server-options
5 | ;; :ring-server-options {:port 9500}
6 |
7 | ;; Target directory https://figwheel.org/config-options#target-dir
8 | ;; you may want to set this to resources if you are using Leiningen
9 | ;; :target-dir "resources"
10 |
11 | ;; Server Ring Handler (optional) https://figwheel.org/docs/ring-handler.html
12 | ;; If you want to embed a ring handler into the figwheel server, this
13 | ;; is for simple ring servers
14 | ;; :ring-handler hello_world.server/handler
15 |
16 | ;; To be able to open files in your editor from the heads up display
17 | ;; you will need to put a script on your path. This script will have
18 | ;; to take a file path and a line number ie.
19 | ;; in ~/bin/myfile-opener:
20 | ;;
21 | ;; #! /bin/sh
22 | ;; emacsclient -n +$2:$3 $1
23 | ;;
24 | ;; :open-file-command "myfile-opener"
25 |
26 | ;; if you are using emacsclient you can just use
27 | ;; :open-file-command "emacsclient"
28 |
29 | ;; Logging output gets printed to the REPL, if you want to redirect it to a file:
30 | ;; :log-file "figwheel-main.log"
31 |
32 | :open-url false
33 | }
34 |
--------------------------------------------------------------------------------
/test/gpig/resources/public/css/style.css:
--------------------------------------------------------------------------------
1 | /* some style */
2 |
3 |
--------------------------------------------------------------------------------
/test/gpig/resources/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Dirac DevTools Demo Project
11 |
12 | Dirac DevTools provides a custom DevTools frontend packaged in a Chrome Extension.
13 | To use REPL from Dirac you also need to start an nREPL server and a Dirac Agent server.
14 |
15 | demo a breakpoint!
16 |
17 | This project has Figwheel Main support as well...
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/test/gpig/resources/public/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test host page
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/gpig/scripts/_shared.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e -o pipefail
4 |
5 | cd "$(dirname "${BASH_SOURCE[0]}")"
6 | cd ..
7 |
8 | ROOT_DIR=$(pwd)
9 | SCRIPTS_DIR="$ROOT_DIR/scripts"
10 |
11 |
--------------------------------------------------------------------------------
/test/gpig/scripts/canary.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # shellcheck source=_shared.sh
4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh"
5 |
6 | exec /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \
7 | --remote-debugging-port=9222 \
8 | --no-first-run \
9 | --user-data-dir=.test-dirac-chrome-profile
--------------------------------------------------------------------------------
/test/gpig/scripts/clean.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # shellcheck source=_shared.sh
4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh"
5 |
6 | rm -rf .cpcache
7 | rm -rf target/
--------------------------------------------------------------------------------
/test/gpig/scripts/repl.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # shellcheck source=_shared.sh
4 | source "$(dirname "${BASH_SOURCE[0]}")/_shared.sh"
5 |
6 | export DIRAC_NREPL__LOG_LEVEL=TRACE
7 |
8 | exec clojure -m dirac-gpig.repl
--------------------------------------------------------------------------------
/test/gpig/test.cljs.edn:
--------------------------------------------------------------------------------
1 | ^{
2 | ;; use an alternative landing page for the tests so that we don't
3 | ;; launch the application
4 | :open-url "http://[[server-hostname]]:[[server-port]]/test.html"
5 |
6 | ;; uncomment to launch tests in a headless environment
7 | ;; you will have to figure out the path to chrome on your system
8 | ;; :launch-js ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "--headless" "--disable-gpu" "--repl" :open-url]
9 | }
10 | {:main dirac-gpig.test-runner}
11 |
--------------------------------------------------------------------------------
/test/gpig/test/dirac_gpig/core_test.cljs:
--------------------------------------------------------------------------------
1 | (ns dirac-gpig.core-test
2 | (:require
3 | [cljs.test :refer-macros [deftest is testing]]
4 | [dirac-gpig.core :refer [multiply]]))
5 |
6 | (deftest multiply-test
7 | (is (= (* 1 2) (multiply 1 2))))
8 |
9 | (deftest multiply-test-2
10 | (is (= (* 75 10) (multiply 10 75))))
11 |
--------------------------------------------------------------------------------
/test/gpig/test/dirac_gpig/test_runner.cljs:
--------------------------------------------------------------------------------
1 | ;; This test runner is intended to be run from the command line
2 | (ns dirac-gpig.test-runner
3 | (:require
4 | ;; require all the namespaces that you want to test
5 | [dirac-gpig.core-test]
6 | [figwheel.main.testing :refer [run-tests-async]]))
7 |
8 | (defn -main [& args]
9 | (run-tests-async 5000))
10 |
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/background.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/background.js:
--------------------------------------------------------------------------------
1 | goog.require("dirac.devtools");
2 | goog.require("marion.figwheel");
3 | goog.require("marion.background");
4 |
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/compiled:
--------------------------------------------------------------------------------
1 | .compiled
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/content_script.js:
--------------------------------------------------------------------------------
1 | goog.require("marion.content_script");
2 |
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/manifest.json:
--------------------------------------------------------------------------------
1 | /* this manifest is for development only
2 | we include all files individually
3 | also we allow unsafe eval for figwheel
4 | */
5 | {
6 | "short_name": "Marion",
7 | "name": "Dirac Marionettist",
8 | "version": "0.0.1",
9 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
10 | "background": {
11 | "page": "background.html",
12 | "persistent": true
13 | },
14 | "permissions": [
15 | "experimental",
16 | "management",
17 | "tabs"
18 | ],
19 | "content_scripts": [
20 | {
21 | "matches": [
22 | ""
23 | ],
24 | "js": [
25 | /* we have to rely on on a symlink */
26 | "compiled/content_script/content_script.js",
27 | "content_script.js"
28 | ],
29 | "run_at": "document_start"
30 | }
31 | ],
32 | "web_accessible_resources": [
33 | "compiled/*"
34 | ],
35 | "manifest_version": 2
36 | }
37 |
--------------------------------------------------------------------------------
/test/marion/resources/unpacked/setup.js:
--------------------------------------------------------------------------------
1 | goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', true);
2 |
--------------------------------------------------------------------------------
/test/marion/src/background/marion/background.cljs:
--------------------------------------------------------------------------------
1 | (ns marion.background
2 | (:require [dirac.shared.utils :refer [runonce]]
3 | [marion.background.core :as core]))
4 |
5 | (runonce
6 | (core/init!))
7 |
--------------------------------------------------------------------------------
/test/marion/src/background/marion/background/core.cljs:
--------------------------------------------------------------------------------
1 | (ns marion.background.core
2 | (:require [dirac.shared.async :refer [