Jez Nicholson (14) [Avatar] Offline
In CodeBuild, if one of the tests fails then it reports an ugly "Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.". The promise doesn't resolve because the assert throws an error.

Am currently reading about it. I'm just getting my head round doing a 'co'-friendly version but am a bit slow. What do you think for:

    it(`Should succeed`, co.wrap(function*() {
      let res = yield when.we_get_player(user)

Yan Cui (49) [Avatar] Offline
Jez Nicholson (14) [Avatar] Offline
I might not have explained code above is modelled on that test, yes, but when it failed in CodePipeline (because I had recreated a DynamoDB table and there was no data) I got a timeout error rather than a proper message about what went wrong. I believe that when an expect() fails that it leaves the promise hanging until it times out. Not 100% certain, but pretty much.
Yan Cui (49) [Avatar] Offline
Ah I see, I misunderstood you! Let me take a look at it and see if there's an easy way around it, would like to keep co as it makes everything easier to read but if it hides errors then that's no good for our tests.
Yan Cui (49) [Avatar] Offline
According to this SO answer the right way to use co with mocha is to include `.then(done, done)` to the co-wrapped Promise.

I'll look around so more to see if there's a more elegant way to do this.