If you run tests before commit then you also run them after rebase, same way as after merge. If tests failed - you can force pull your branch from remote and have the same state as before rebase.
In my experience people are not running tests locally at all. Push to the remote, open pull request and wait for pipeline results.
In such situation the result will be the same: you will never know which commit from merge/rebase brakes your pipeline tests.