I've seen lots of info on testing Promise rejections, but wondering if anyone knows how to write a test that will fail if a promise chain doesn't end with a '.catch'? I'm trying to protect against swallowed errors.
For example, this would pass the test:
doSomething() // returns a Promise
.then(doSomethingElse) // returns a Promise
.then(handleResult)
.catch((err) => { console.log(err); }); // logs errors from any rejections
And this would fail:
doSomething() // returns a Promise
.then(doSomethingElse) // returns a Promise
.then(handleResult); // no catch = swallowed errors
I'm using mocha and chai-as-promised. I'm not using any promise libraries, just native es2015.