This is already possible with a tiny bit of scripting: Teensy 4.1 Unit Testing Issue - #5 by maxgerhardt
Also see the tiny bit of script at the bottom of Add test start delay option · Issue #3742 · platformio/platformio-core · GitHub that waits for the monitor_port
specified in the platformio.ini
.