Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Relative Paths in Test Mock Generation #3457

Open
trevor-holliday-instacart opened this issue Oct 9, 2024 · 4 comments
Open
Labels
feature New addition or enhancement to existing solutions low-priority testing

Comments

@trevor-holliday-instacart
Copy link

trevor-holliday-instacart commented Oct 9, 2024

Use case

I would like to request the ability to use a relative path when generating test mocks with Apollo iOS. Currently, the primary code generation configuration supports specifying a relative path, which allows efficient distribution of code across individual frameworks. This capability helps our team reduce build times effectively.

However, when it comes to generating test mocks, we are forced to place them all within a single framework. As a result, this framework becomes a dependency for most of our test frameworks, leading to significant build slowdowns — adding minutes to each build process.

Describe the solution you'd like

By facilitating the use of relative paths for test mock generation, similar to the primary codegen config, we can distribute test mocks across individual frameworks. This change would:

  • Reduce build times by preventing unnecessary dependencies on a single framework.
  • Enhance encapsulation and modularity of individual frameworks, improving the overall architecture.
  • Align the test mock generation process with the flexibility provided by the primary code generation configuration.
    Benefits:

Performance:

  • Distribution of test mocks would decrease the build time significantly.

Encapsulation:

  • Frameworks remain independent, aligning test code with framework-specific needs.

Scalability:

  • Enables teams to scale and manage their iOS projects more effectively by leveraging clean architectural boundaries.
@trevor-holliday-instacart trevor-holliday-instacart added the feature New addition or enhancement to existing solutions label Oct 9, 2024
@AnthonyMDev
Copy link
Contributor

Thanks for the request @trevor-holliday-instacart! We would need to do some exploration to ensure that this is feasible, but I can't come up with a reason why not off the top of my head.

Test Mocks are in need or a lot of TLC in general, and this seems like something I'd like to support with them. But we have a lot of other projects on our roadmap right now, and it may be a while before Test Mocks get any new attention. I'll keep this issue open for when we get a chance to look at them again.

@AnthonyMDev
Copy link
Contributor

@trevor-holliday-instacart I'm curious why you believe this is affecting your build times so dramatically. Have you done profiling to validate that this is the case?

@trevor-holliday-instacart
Copy link
Author

Hey @AnthonyMDev.

Yes, we added the new mocks to our application and saw an increase of about 7.5 mins per build.

@AnthonyMDev
Copy link
Contributor

Okay thanks for following up. That still seems really odd to me, but seems like it IS happening. At some point, we're going to make another pass at a lot of improvements to the TestMocks. This should be included in that effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New addition or enhancement to existing solutions low-priority testing
Projects
None yet
Development

No branches or pull requests

2 participants