ReactiveCocoa/reactiveswift-composable-architecture

Change TestStore so that it isn't only compiled when running in DEBUG

lukelabonte opened this issue · 4 comments

On one of the projects I work on, we are forced to pull in CA manually. This is because we have a build configuration for testing that isn't DEBUG. However, this means that we can not use TestStore since that is guarded by DEBUG. It would be nice to be able to use TestStore regardless of project configuration.

Would it be possible to remove the #if DEBUG here?

I'm not sure that making TestStore available in release builds would be a good idea, or that it would even work, as it references XCTest.

Why are you testing the store in a non-DEBUG configuration?

You could try defining DEBUG in your non-DEBUG configuration, but I'm not sure if that will have other undesirable side-effects.

Why are you testing the store in a non-DEBUG configuration?

We have a UNITTEST configuration on the project in question; we use it for our tests and a couple of other things.

You could try defining DEBUG in your non-DEBUG configuration, but I'm not sure if that will have other undesirable side-effects.

We have tried this, it didn't work well from what I recall.

All that the default Debug build configuration does is define DEBUG=1. There is nothing to prevent you setting that in any other build configuration:

image

I can only see that being a problem if for some reason your UNITTEST configuration depends on DEBUG not being defined.

As this is a very specific use case, I don't see a good reason to allow TestStore to be compiled for non-DEBUG builds, for the reasons I already mentioned (it's very closely tied to XCTest).

I'm closing this issue as it's not something we plan to support.