Unit testing CLI target

I am trying to find out best way to test cli target, and one of them is via static library

So create a static librarry move all code to that and call some bridge function form cli’s main to this library

add test target bundle for library, and code can be tested,

is this is the only way or anyone knows better way than this?

If this is only way, I am facing problem with using of ExpressibleByArgument in file which is importing ArgumentParser internally, because static library can’t use

import ArgumentParser

instead of this it has to use

internal import ArgumentParser

but with internal import not able to use

ExpressibleByArgument

Note: I am not using swift package manager

Is your type conforming to ExpressibleByArgument marked as public or package by any chance? If so, try removing public or package from it to follow the import restriction.