Refactor tests to return Promises when possible
See original GitHub issueThroughout Ghost’s test suite there are many places where the done()
async callback is used to handle asynchronous behavior. There are also many places where the test function returns a promise.
As part of #7165 the test cases that returned promises explicitly were refactored to not use the done()
callback to handle behavior. (Mocha 3 throws an exception if you use both).
However, there are still lots of places throughout the tests that still use the done()
callback because the test function doesn’t return a Promise when it should.
To close this issue, all of the tests cases need to be evaluated to see if they can return a Promise. If so, then they should be made to, and the done()
callback should not be used in those instances.
Note: there still may be scenarios where the done
callback needs to be used (for instance, if the test can’t return a promise) However, because most of the test functions that have asynchronous behavior do deal with promises, the need for explicitly using done
should be very little
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@ErisDS @kirrg001 Thank you so much for the information, I would like to work on #7696 as well as upgrading sinon/mocha.
@janvt there’s already a PR open for this in #7254 - you might see if you can help out there 😃