There is a point nobody here is making, which is that all the examples use the wrong signature for callbacks, which is function(err, result). The problem is not interop between the two, which is fairly easy - the problem arises when not using standard signatures. Seems like all the fuss could be avoided too because Mocha supports both promises and callbacks.
function asCallback(promise, callback) {
return Promise.resolve(promise)
.then(result => callback(null, result))
.catch(callback)
}
// returns a new fn that takes same args which returns promise instead
function asPromise(fn) {
return (...args) => new Promise((resolve, reject) => {
fn(...args, (err, result) => {
if (err) return reject(err);
resolve(result)
})
})
}