Closed arichiardi closed 8 years ago
Another option for node specific code would be to include it in your build config section, say something like :source-paths ["src" "test" "platform/node"]
.
@arichiardi I'm not sure I understand. Do you want to know inside the cljs test what is currently running? If so, you can look at https://github.com/bensu/maxwell
You can do this:
(ns some.tests
(:require [cljs.test :refer :all]
[maxwell.spy :as spy]))
(deftest runner-dependent-test
(cond
(spy/chrome?) (test-in-chrome)
(spy/safari?) (test-in-safari)
:else (test-everywhere-else)))
If that doesn't solve your problem, please explain further so we can figure it out.
I think @arohner was doing something similar.
Basically I have tests here: https://github.com/ScalaConsultants/replumb/blob/master/test/cljs/replumb/repl_test.cljs
I would like to change the target options (at runtime) based on the build I'd, if it's nodejs I would like to pass :target :nodejs
to my read-eval-call
.
If that is all you want then you can use doo.runner/node?
from inside your tests. You can see it's implementation here
Oh great I did not see it, sorry about this, I even skimmed through the source...but too quickly it seems :)
No problem! I'm closing this then.
Hi @bensu,
I wanted to ask you if there is a way to know which runner is currently executed in order to pass it to my tests. For instance to execute node-specific configuration as test fixture.
If this is not exposed, I could work on doing it and submit a PR ;)