I have a block like below, which is a function using async
If I add an assert statement in there, it will stop the code executing at that line, but no error is thrown. It just dies silently :(
async function testMongo() {
let db = await dbConnect();
await db.collection("stories").remove({});
let c = await count("stories", {} );
assert.strictEqual(c, 999); // should fail
console.log("moving on..."); /// will never get reached.
}
Is there some reason that the assertion maybe gets swallowed up? I've had problems like these before with errors inside event emitters, and it seems the immediate return of the async function is some type of event emitter/Promise.