ClojureScript

Cannot pass custom env to run-tests

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Calling (cljs.test/run-tests (cljs.test/empty-env :my-reporter)) does not actually pass the environment with a custom reporter key onwards. I think the problem lies here: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/test.clj#L257

We should pass ~env-or-ns argument to cljs.test/test-ns call, because now the single-arg version internally creates a new empty environment (see: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/test.clj#L309).

Activity

Hide
Kimmo Koskinen added a comment -

Seems that adding ~env-or-ns to cljs.test/test-ns call in test-ns isn't enough. Summary is still reported with the :cljs.test/default reporter.

Show
Kimmo Koskinen added a comment - Seems that adding ~env-or-ns to cljs.test/test-ns call in test-ns isn't enough. Summary is still reported with the :cljs.test/default reporter.
Hide
David Nolen added a comment -

Kimmo do you have a minimal example of something that you think should work so that we can use it as a test? Thanks.

Show
David Nolen added a comment - Kimmo do you have a minimal example of something that you think should work so that we can use it as a test? Thanks.
Hide
Kimmo Koskinen added a comment -

Could this be of help? https://gist.github.com/viesti/bba5c88abbb2f6ecb914

The call to (test/run-tests (test/empty-env :karma)) should print a message "Testing with Karma myapp.test" instead of "Testing myapp.test".

Show
Kimmo Koskinen added a comment - Could this be of help? https://gist.github.com/viesti/bba5c88abbb2f6ecb914 The call to (test/run-tests (test/empty-env :karma)) should print a message "Testing with Karma myapp.test" instead of "Testing myapp.test".
Hide
Kimmo Koskinen added a comment -

Thanks for that fast reply! I tried the patch quickly, and report method is called on the :begin-test-ns phase correctly. However, on the :summary phase, my custom report method isn't called.

I updated the gist: https://gist.github.com/viesti/bba5c88abbb2f6ecb914. It should print "All done" at end of the test, instead of "Ran 1 tests containing 1 assertions.
0 failures, 0 errors.".

Show
Kimmo Koskinen added a comment - Thanks for that fast reply! I tried the patch quickly, and report method is called on the :begin-test-ns phase correctly. However, on the :summary phase, my custom report method isn't called. I updated the gist: https://gist.github.com/viesti/bba5c88abbb2f6ecb914. It should print "All done" at end of the test, instead of "Ran 1 tests containing 1 assertions. 0 failures, 0 errors.".
Hide
Kimmo Koskinen added a comment -

Thanks!

Show
Kimmo Koskinen added a comment - Thanks!

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: