Swift Package Tests in Test Plan: “Module was not compiled for testing”

My iOS app consists of one app target and several local SPM packages. Previously, I had a test plan which only included the app target’s tests, while the packages’ tests were launched separately using the packages’ scheme names.

Now, I’m trying to switch to test plans entirely. I included the test targets defined in the packages in the test plan. However, doing so resulted in the following error message, attributed to @testable import statements:

Testing failed:
	Module '<***>' was not compiled for testing
	Command CompileSwiftSources failed with a nonzero exit code
	Testing cancelled because the build failed.

If I understand it correctly, the error occurs because the Enable Testability (ENABLE_TESTABILITY) build setting defaults to NO, preventing the packages’ internal symbols from being exposed with @testable imports. Since Swift packages do not use Xcode project files, I’m confused about where I should define this setting. Besides that, testability is expected to be enabled only for test and not release builds, while Swift packages don’t support build configurations.

Am I missing something? Is there a way to make Swift packages and test plans play nice together?