PlatformIO in VS Code is not setting PIO_UNIT_TEST when running the unit tests with Test Explorer

When running with Test Explorer the PIO_UNIT_TEST is not set.
When running the Tests with the Project Tasks PIO_UNIT_TEST is set.

This results in some tests failing when running with Test Explorer.
In detail I have some tests ensuring that the setup of my arduino is working as expected. Since Serial operator bool is not fakable (not included in ArduinoFake) I had to exclude the while(!Serial) loop during unit tests on my the native platform. I did that with an #ifndef PIO_UNIT_TEST statement.

Is there a other way to do that?

Please file an issue against