mix_eunit icon indicating copy to clipboard operation
mix_eunit copied to clipboard

Can't run tests inside ifdef(TEST)

Open netDalek opened this issue 6 years ago • 2 comments

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

netDalek avatar Apr 03 '18 06:04 netDalek

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 avatar May 19 '20 10:05 n-epifanov

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

n-epifanov avatar May 19 '20 12:05 n-epifanov