Q:

In mocha failing "assert" in assert function results to timeout instead of fail

I have a following test:
it ('clears the many cache when a new document is inserted', () => {

return new Promise(async(resolve) => {
    const entity = new Entity(connector, collectionName);
    entity.insert({_id: '2'});
    result = await entity.findManyCached();

    // this assert does not fail the test, but makes the case time out
    assert.deepEqual(result, [{_id: 1}]);
  })
})

How can I collect the result of that failing assert instead of timeout? 

A:

I think what happens is that because of making the executor function of the promise async, you'll get the equivalent of this:
return new Promise(outerResolve => {
  return new Promise(innerResolve => {
    ...
    assert.deepEqual(...);
  })
})

Any exceptions that get thrown by assert get swallowed up by the inner promise, and the outer promise will never be resolved or rejected, hence the timeout.
Standalone demo:
let p = new Promise(outerResolve => {
  console.log('outer promise');
  return new Promise(innerResolve => {
    console.log('inner promise');
    throw Error('foo');
  })
})

// This doesn't log anything:    
p.then (x => console.log('resolved'))
 .catch(e => console.log('rejected'));

Here's a workaround:
it ('clears the many cache when a new document is inserted', async () => {
  const entity = new Entity(connector, collectionName);
  entity.insert({_id: '2'});
  let result = await entity.findManyCached();

  // this assert does not fail the test, but makes the case time out
  assert.deepEqual(result, [{_id: 1}]);
})

