rebase --exec

Run tests for each commit and stop when they fail

git rebase -i origin/master --exec 'npm test'