> Can you please expand on how the files would be used compared to directly running the stale tests?
Initially I was thinking of being able to do something like:
- At one point in time: `mix test --get-stale`
- Later: `mix test --get-stale`
- Diff the two outputs, and only run the tests that appear in both? (now that I type this out, I realize this probably doesn't help)
This might be a case of the "XY problem"; perhaps what I want is not "print the list of tests that `mix test --stale` would run", but something like "given the current state of the code, and these new code/module changes, give me the list of tests that should be considered 'stale' and should rerun".
Here's more of a typical business scenario I envision:
- I have a project branch `main` in which CI runs all tests (say, 1000 tests) on every PR merge.
- Until then, CI should only run a subset of tests on each commit to a new PR.
- On `main`, I run `mix test --stale` locally, and all 1000 tests pass.
- Ideally I could cache/snapshot this "state" or point in time, or CI could generate it directly on `main`.
- I make a new branch `feature/a`, make code changes, add a couple new tests.
- I run `mix test --stale` locally, lets say that only 100 tests need to run based on the code changed.
- I submit a PR.
- Current setup: CI tries to run `mix test --stale` but ends up running all 1000 tests again instead of just the 100 whose code/state was actually "stale".
- Preferred setup: CI runs `mix test --stale` (or something else) and only reruns tests that would be considered stale after my commits were made.
- PR merges into `main`, and just in case all 1000 tests are run again.
#14393 definitely looks interesting and I'll keep an eye on it!