Add on-testing-complete hook

Description

When a test runner runs async tests created with cljs.test/async there is no reliable way to return the control from the async code in the test suite to the test runner. This is problematic since the test script might need the tests results to proceed or terminate.

A function to be called after all tests are done is proposed: cljs.test/on-testing-complete-fn and it would take the test summary as its only argument

It can be set by the user by calling cljs.test/set-on-testing-complete! which should be callable from JS (^:export)

Notes:
In the patch, the function cljs.test/successful? also has the ^:export metadata to be called from JS test runners.
The code was tested manually with V8, Spidermonkey, Nashorn, SlimerJs, and PhantomJS but not with JavaScript Core.

Environment

None

Activity

Show:
Sebastian Bensusan
May 12, 2015, 11:39 AM

Added :end-run-test event to cljs.test and a dummy event handler for it.

Leon Grapenthin
May 12, 2015, 10:09 PM

For API consistency this should also be in the blocks of `test-all-vars` in `test-ns`, `test-var` and `test-vars`.

David Nolen
May 12, 2015, 10:24 PM

Happy to see a new ticket + patch that addresses the consistency issue.

Sebastian Bensusan
May 13, 2015, 8:51 AM

Leon, I filled to address your point. Feel free to add any other API inconsistencies that :end-run-tests introduced.

Completed

Assignee

Unassigned

Reporter

Sebastian Bensusan

Labels

Approval

None

Patch

Code

Fix versions

Affects versions

Priority

Minor