restructure for tests without child_process.exec