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?