How to catch failed test?

I’m trying to create a collector for all failed tests in the collection, is there a way to catch a failed test when using pm.test?