From what I understand, the mocha test framework will throw this error if some error occurs in the before
method:
> $(npm bin)/mocha test/*.j
As I was posting this question, I stumbled on this bug which led me to the discovery that I need to make a call to this.enableTimeouts(false)
in the beginning of the before
function, like so:
let server
before(function(done) {
this.enableTimeouts(false) <----
server = require('../app')
server.initialize()
.then(() => {
console.info('listening on', process.env.PORT)
server.listen(process.env.PORT, done)
})
.catch(err => {
console.log(err)
done(err)
})
})
Hopefully this helps someone else a few hours of debugging.