Post

In the next version of Vitest you can track leaking asynchronous resources via `--detect-async-leaks` option! Available in v4.1.0-beta.4 release. 🔍 (notice missing await in the example)

Using async_hooks you can hook promise creation and completion. Using this you can track all promises that weren't awaited. You just need to capture a stack trace at creation so you can point out where the missing await was. Capturing a stack trace for every promise has overhead hence the opt-in!

Yes exactly! In addition to performance impact, one downside is that this is Node-only feature. With CDP we could probably detect unresolved fetch calls, but would still be unable to point those to specific stacktraces.