There are few solutions given by Jest in that direction. I have tried out most of the solutions like --findRelatedTests, --onlyChanged, --changedSince. But there are few shortcomings in every solutions. I thought --changedSince is the best match for me.
jest --changedSince=origin/master --coverage
It mostly covers the basic scenarios like running test files corresponding to the changed source files. But it does not handle few scenarios like if a source-file(say a.js) is deleted and same(a.js) is being used(imported) in another file(say b.js), it does not run tests for any of the files(a.js or b.js). It does not seem to run tests for parent files where it was imported.
Is there a clean solution which can handle all the scenarios like file rename/deletion, dynamic imports, running tests for the parent modules where it was imported or any other impact that may happen when you change a source file?