Unit testing async functions in node/express
Is it a bad practice to insist functions return a value, which isn't required, simply to make testing easier? Are there any side effects of this?


I wouldn't say it's bad practise, having to provide anchors for test purposes isn't uncommon. Side affects would really boil down to how &amp; where it's being used, in this case it looks very much like Express middleware and nowhere in the docs does it mention any rules about not returning values. Furthermore, if you dig into the source you'll find that middleware return values are ignored.

I think in your case returning a Promise from the middleware is the ideal solution.