Ok, together with 🚫💩lint-staged and the built-in Jest argument
--findRelatedTests this is actually pretty easy!
As you can see here, Jest has an CLI parameter in order to run only related tests for the files you pass to Jest: https://jestjs.io/docs/en/cli#--findrelatedtests-spaceseparatedlistofsourcefiles
And as awesome as lint-staged is, it passes all the changed files to the CLI commands you've provided 😁
So your preferred lint-staged config should look like this:
This will look for changed js, jsx, ts and tsx files in your staged git files before you commit them, and will run all you related Jest tests. If any test is failing, lint-staged will make sure you're not committing bad code to your repo. 🥳