Update: I figured out how to get Platform IO to stop gathering irrelevant dependencies from src/main.cpp
during testing! No need to manually ignore them via lib_ignore
!
platformio.ini
[env:desktop]
platform = native
lib_ldf_mode = chain+
src/main.cpp
#ifndef PIO_UNIT_TESTING
...
#endif // PIO_UNIT_TESTING
(The +
in chain+
makes it respect directives like #ifndef
when determining dependencies.)