Odaeus
Test *file* run order with mix test
Hi all,
I recently added a test that mistakenly modified some global state and caused failures in later tests. This failure occurred on CI but not locally. I want to recreate it locally by running:
$ mix test test/c_test.exs test/b_test.exs --trace
Where c_test.exs contains the state-modifying code. But the tests are always run with b first and c second. Even renaming c_test.exs to a_test.exs did not change the order! ![]()
I expected that mix test would honour the order given on the command line but I guess it ends up being re-ordered internally?
This question was already asked in 2017 but that thread became derailed. However, in my case the shared state was accidental and it seems necessary to be able to specify test file order to track this problem down. Is there a workaround?
Most Liked
LostKobrakai
Afaik the order of tests is determined by the seed. So you should be able to get deterministic order by setting the same seed between invocations.







