[Proposal] Allow specifying project files in mix test command

19 views
Skip to first unread message

Blake Kostner

unread,
Sep 19, 2025, 5:17:02 PM (8 days ago) Sep 19
to elixir-lang-core
Right now we have two really nice filtering options for the `mix test` command:

- We can filter by test paths or even test line numbers like `mix test test/my_app/some_feature_test.exs`
- We can run `mix test --stale` to run tests that have had changed referenced code since last run.

These are both great, however there are some situations where these fall short. The two big ones I have hit myself are:

- In PR CI where we have a list of changed files (both project and tests)
- In git commit hooks where we also have a list of changed files

It would be very helpful if we could specify a list of project files along side test files when running `mix test`. For instance, being able to run `mix test lib/my_app/my_feature.ex` and have the compiler find all test files that have references to that file and run tests based on that list. This is similar to the `--stale` option, but more flexible in it's use case, and not being directly tied to the previous `mix test` run. It can hopefully go a long way into speeding up large code bases by only running tests related to relevant code changes.


Reply all
Reply to author
Forward
0 new messages