You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have recently updated Apollo to version 1.7.0 in our project. We are not willing to update it further for now. We have encountered an issue that requires resolution. Our project setup involves adding ApolloTestSupport and ApolloAPI as targets in our Swift Package Manager (SPM) package along with other targets. This setup is necessary because we need to generate mock responses, and we are using mocks at various places in our code.
Here is a summary of our configuration:
We have added ApolloTestSupport and ApolloAPI as targets in our SPM package.
Inside this SPM, there are multiple targets, each with separate test mock folders generated using ApolloCodegen.
The issue arises when we try to compile the project. The error messages indicate that ApolloAPI was not compiled for testing.
Error Messages:
"Module 'ApolloAPI' was not compiled for testing"
Steps to Reproduce:
Screenshots:
Error Messages:
We seek guidance on how to resolve this error without removing ApolloTestSupport and ApolloAPI from our SPM targets since mock responses are a requirement for our project.
Any advice or suggestions would be highly appreciated.
Version
Apollo v1.7.0
Steps to reproduce the behavior
Update Apollo to version 1.7.0.
Add ApolloTestSupport and ApolloAPI as targets in the SPM package.
Attempt to build the project.
Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Hi @divyansh0201 - this is being caused by the @testable attribute on the import of ApolloAPI in TestMock. As you're finding out, release builds do not enable testability by default. ApolloTestSupport was originally intended only for test cases but it's use has grown outside of that.
We switched to using an SPI import in PR #362 which was released in version 1.12.0. That should resolve the issue for you.
If you're not willing to move further past 1.7.0 you will need to fork from 1.7.0 and attempt to cherry-pick the PR but I'm not sure whether it's compatible.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.
Hi @divyansh0201 - this is being caused by the @testable attribute on the import of ApolloAPI in TestMock. As you're finding out, release builds do not enable testability by default. ApolloTestSupport was originally intended only for test cases but it's use has grown outside of that.
We switched to using an SPI import in PR #362 which was released in version 1.12.0. That should resolve the issue for you.
If you're not willing to move further past 1.7.0 you will need to fork from 1.7.0 and attempt to cherry-pick the PR but I'm not sure whether it's compatible.
Summary
We have recently updated Apollo to version 1.7.0 in our project. We are not willing to update it further for now. We have encountered an issue that requires resolution. Our project setup involves adding ApolloTestSupport and ApolloAPI as targets in our Swift Package Manager (SPM) package along with other targets. This setup is necessary because we need to generate mock responses, and we are using mocks at various places in our code.
Here is a summary of our configuration:
We have added ApolloTestSupport and ApolloAPI as targets in our SPM package.
Inside this SPM, there are multiple targets, each with separate test mock folders generated using ApolloCodegen.
The issue arises when we try to compile the project. The error messages indicate that ApolloAPI was not compiled for testing.
Error Messages:
"Module 'ApolloAPI' was not compiled for testing"
Steps to Reproduce:
Screenshots:
Error Messages:
We seek guidance on how to resolve this error without removing ApolloTestSupport and ApolloAPI from our SPM targets since mock responses are a requirement for our project.
Any advice or suggestions would be highly appreciated.
Version
Apollo v1.7.0
Steps to reproduce the behavior
Update Apollo to version 1.7.0.
Add ApolloTestSupport and ApolloAPI as targets in the SPM package.
Attempt to build the project.
Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: