vendredi 25 mars 2016

ExUnit - run all tests stored in a custom directory (not tests/)

I want to have two separate sets of unit tests in my Elixir project that I can run separately with different ExUnit configurations. I am working on an ExUnit formatter and I am trying to write unit tests for it. In order to test it I figured I would create another directory (example_tests) containing a test_helper.exs file with similar to the one in test/, but with ExUnit configured to use my custom formatter. I added my formatter as an ExUnit formatter and then created a test module example_tests. The problem is now I don't know how to configure ExUnit to run all the tests in example_tests/ with the configuration specified in example_tests/test_helper.exs.

I found there is a test_paths configuration parameter than can be set in the mix.exs file. The problem is that value is set on a per project basis and I need it to have two different values (normally just ["test"] but then for the test run with the formatter ["example_tests"]). I assumed I could override the configuration values on a per-task basis so I created an example_tests task as well, but I can't figure out how to alter the configuration.

Is there a way to customize the project configuration (Mix.Project.config), on a per-task basis? Or, is there better way to create two separate sets of tests with different ExUnit configurations?

Aucun commentaire:

Enregistrer un commentaire