How can we test SwiftPM Plugins?

How can we test SPM Plugin?

It does not seem to be possible to test plugins because we cannot import Plugins in Tests. Or am I missing something?

Thanks,

2 Likes

We don't have any specific feature to test plugins, that is correct. What I would currently do is to extract the functionality into an executable and then test the executable. The plugin would only be calling the executable with the right parameters and therefore would not need to be tested as much.

3 Likes

Thanks for the quick response.

I have moved what I would have had in a library to a folder that is in the plugin and made a symbolic link to create a fake-shared library that I use for testing to go around this limitation.

I prefer having the simplest executable possible or not using an executable and having most of the implementation in the plugin.

1 Like

Thanks @mackoj!