dantswain / mix_eunit

A mix task to execute eunit tests.
MIT License
17 stars 10 forks source link

Can't run tests inside ifdef(TEST) #10

Open netDalek opened 6 years ago

netDalek commented 6 years ago

Hi, thanks for this mix task. I've found interesting bug. I've created simple repo to reproduce it https://github.com/netDalek/mix_eunit_test

If I run mix eunit from apps/subupp folder everiting is ok and it runs all 2 tests. But if I run the same from the root folder it runs only test without ifdef(TEST)

mix_eunit_test|master ⇒ mix eunit
.
Finished in 0.012 seconds
1 tests, 0 failures
mix_eunit_test|master ⇒ cd apps/subapp && mix eunit
..
Finished in 0.015 seconds
2 tests, 0 failures
n-epifanov commented 4 years ago

More info on this issue: when run for an umbrella app and it has in-umbrella dependencies they're build without TEST defined. Then when those dependency-apps are tested they are not rebuild with TEST, hence report to have 0 tests in them.

n-epifanov commented 4 years ago

The workaround that allows running mix eunit from project root is to pass compiler flags explicitly: ERL_COMPILER_OPTIONS="[debug_info, {d,'TEST'}]" mix eunit