Is there a tool to use Dialyzer with tests?

I know there is a manual and a bit cumbersome process to do this was wondering if anyone built an automated tool?

I just have my mix file call dialyxir before running tests, what are you wanting to do?

Basically is this the simplest way to do this or is there a more automated way :)?

Heh, I’m still curious ‘what’ you are trying to do. Do you just want to run dialyzer automatically when running mix test or…? If so you can just set an alias in your mix.exs file to be like "test": ["dialyzer", "ecto.create --quiet", "ecto.migrate", "test"] or so. :slight_smile:

I want to run dialyzer on some of the tests I guess for same reason as the above article outlines.

Dialyzer runs on compiled (BEAM) files, not individual tests nor is it capable of from my recall. You can always put whatever test you want dialyzed into a certain namespace then glob that pattern for the beam files to test so you can expand it easily? I still highly recommend running it on everything though. :slight_smile:

OK but it will not run over code in .exs test files as they are not getting compiled so all the fiddling outlined in the article above still applies or am I missing something ?

Aaaaah, you want to run it over the test files themselves (I’m unsure how well this could work since I often like to make purposefully failing tests to assert that they fail, and this would also fail dialyzer in many cases).

Well in that case you could make a simple script to elixirc the test exs files into a custom temporary output directory then run dialyzer over them. It would be fairly easy to make up a library to do that for a user if you want to make it? ^.^

1 Like

Cool thanx I guess my question was if anyone made something to automate this :slight_smile: I guess the answer is no. Sorry for not formulating things clearly I need to get some sleep :slight_smile:

1 Like

All good, we know how sleep goes, plus I should have figured that out sooner. ^.^