split out flake detection from utility to detect changed tests (#67611)
This splits out the existing logic for detecting changed/added tests
into a separate util, so it can be leveraged by #67612.
No changes in functionality, aside from replacing informational logs
with `console.log` rather than `console.error` and a tweak to arg
parsing.