Nice tip by Kamran Ahmed:
Find the commit that broke the tests
$ git rebase -i –exec "yarn test" d294ae9
This will run "yarn test" on all the commits between d294ae9 and HEAD and stop on the commit where the tests fail
— Kamran Ahmed (@kamranahmedse) February 2, 2020
If you want to go back X commits use a regular
git rebase HEAD~3 --exec "yarn test"