Redundancy between `library.json` and `platformio.ini`

If I’m producing a library that contains tests, how can I avoid repeating myself in library.json and platformio.ini, for things like build flags and dependencies?

This is brought up here too.

Do these files serve fundamentally different purposes, or is it on the roadmap to merge them?

pio test command requires platformio.ini file because it should know under which environments to test your source code from src directory.

library.json is required for build system to handle extra flags when your library will be used by other developers.