PlatformIO Community

Unit test error - sdkconfig, esp idf

trying to compile and do unit test. ALl i have done is added a test folder, with a test file, and
#include <unity.>
but, when i run with environment being native, i get an error looking for the sdkconfig.h
pio run -e native

Setup: vscod, Esp idf, custom library under library folder, platformio.ini includes data for both setups.

Setting up for CI, so want some tests to run on Host OS and some to run on the esp32.

Thoughts?

I can ignore the library I have buy then how do I include it for unit testing?

Do I need to do all unit tests in just the test folder?

I can do the ifndef UNIT Testing but I have to do it everywhere…

Since you mention ESP-IDF and ESP32… I take it your library is not meant for use on a desktop (i.e. native)? Instead of pio run -e native … you should probably be running pio test -e esp32env?

You may want to re-visit the documentation on unit testing, particularly one of the examples. All of your unit testing should be done in the test folder, as PIO by default does not see nor build code in the \src folder. If you need to change that behaviour, have a look at the shared code side of things.