I am lately deprecating a legacy module in a project and obviously want all the tooling help I could get.
In the umbrella app I am calling
mix xref callers Module.function/1 and it correctly lists the users of the function… except for the several tests that also use it. I tried in
test environments, results are the same (I suspect this is highly irrelevant but I tried anyway). I also tried running the command directly inside each of the apps – output still doesn’t include tests.
Is this the intended behavior? Right now I can’t justify using
mix xref callers as opposed to a well-crafted
Apologies if I am missing something very obvious. The official docs do not give me anything extra to work with though. Are there options to include extra directories and/or environments to
The problem is that
mix xref works on compiled modules and tests are not compiled. I’m not sure how this could be solved, though.
Makes sense, and ouch. Unit tests are very active users of the modules I want deprecated and evolved – and we absolutely need the tests shown so as to make a safe transition.
This might not be the desired answer, but what’s the problem with ignoring the tests and letting them fail when you remove the module? You can just refactor the red ones when the time comes.
I guess that can work. Not my way of doing things but the result would be the same.
Only argument against I can think of is that I don’t want to remove the legacy modules immediately. They are slightly complex and I might have missed some of their quirks while refactoring them into the next gen modules. So they have to be around for a while. But nothing stops me from renaming them and still have the tests fail so I can refactor them.
Accepting your answer. There’s no other way anyway.