Skip to content

Running tests at the REPL #33

@mfikes

Description

@mfikes

With the Cognitect test runner, you can run all your tests while via the REPL by simply doing

(require '[cognitect.test-runner])
(cognitect.test-runner/test {})

I was wondering if the same could be done with cljs-test-runner.

An experiment shows that it is probably possible via a macro.

https://github.com/mfikes/cljs-test-runner/tree/repl

The output of this experiment is below.

Before delving into this too far, wanted to share and see what your thoughts are.

Mikes-iMac:cljs-bean mfikes$ clj -A:repl/node
ClojureScript 1.10.520
cljs.user=> (require 'cljs-bean.core-test)
nil
cljs.user=> (require 'cljs-test-runner.test-runner)
nil
cljs.user=> (cljs-test-runner.test-runner/run-tests {})
WARNING: Use of undeclared Var doo.runner/set-entry-point! at line 31 cljs-test-runner-out/gen/cljs_test_runner/gen.cljs
WARNING: Use of undeclared Var doo.runner/karma? at line 31 cljs-test-runner-out/gen/cljs_test_runner/gen.cljs
WARNING: Use of undeclared Var jx.reporter.karma/start at line 31 cljs-test-runner-out/gen/cljs_test_runner/gen.cljs

Testing cljs-bean.core-test
{:result true, :num-tests 100, :seed 1561756175726, :time-elapsed-ms 262, :test-var "roundtrip-1"}
{:result true, :num-tests 100, :seed 1561756175989, :time-elapsed-ms 144, :test-var "roundtrip-2"}
{:result true, :num-tests 100, :seed 1561756176133, :time-elapsed-ms 102, :test-var "roundtrip-3"}
{:result true, :num-tests 100, :seed 1561756176235, :time-elapsed-ms 91, :test-var "roundtrip-4"}

Ran 72 tests containing 510 assertions.
0 failures, 0 errors.
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions