JasmineWD causes tests to hang if used with Jasmine's stopSpecOnExpectationFailure
juliemr opened this issue · 2 comments
JasmineWD causes tests to hang if used with Jasmine's stopSpecOnExpectationFailure. This prevents Protractor tests which rely on JasmineWD from using fast fail.
This appears to be an effect of the adapter catching errors and calling done.fail
, but calling done.fail
inside a context where the error that Jasmine tries to throw then is caught and never passed back down to Jasmine. This comes from the callWhenIdle
method which attempts to wait until the scheduler is done.
In Jasmine with stopSpecOnExpectationFailure, done.fail will add a failed expectation, which throws an error, which means that done.fail doesn't get a chance to clean up. It relies on a global error handler to catch the error and terminate the test.
Something about the webdriver control flow's scheduler is preventing the thrown error from reaching the global error handler, resulting in the hanging test.
All my attempts to fix this have had bad consequences somewhere in the test suite. I'm inclined to say that this is a fundamental issue with JasmineWD and fast fail, and that the best step forward is to encourage removing JasmineWD and reliance on the control flow in general. Prefer async/await
for controlling asynchronous flow in tests.