The root cause is that jasmine determines if it should run a test in async or sync mode based on the number of arguments the function provided to it takes. If the argument length is 0, then jasmine does not wait for the done to be called.
This modifies runSpec to always run in jasmine async mode, wrapping non-promise results in promise that resolves immediately.
Tested by using npm link wdio-sync into both wdio-jasmine-framework andwdio-mocha-framework to ensure changes support both frameworks.
This fixes https://github.com/webdriverio/wdio-jasmine-framework/issues/13 where jasmine test does not wait on promises returned by the
it
block.The root cause is that jasmine determines if it should run a test in async or sync mode based on the number of arguments the function provided to
it
takes. If the argument length is 0, then jasmine does not wait for the done to be called.This modifies runSpec to always run in jasmine async mode, wrapping non-promise results in promise that resolves immediately.
Tested by using
npm link wdio-sync
into bothwdio-jasmine-framework
andwdio-mocha-framework
to ensure changes support both frameworks.Also tested with example project originally reproducing the issue here. webdriverio-async-jasmine-tests