Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve Mocking Documentation to include detox build #1116

Closed
abury opened this issue Jan 14, 2019 · 8 comments
Closed

Improve Mocking Documentation to include detox build #1116

abury opened this issue Jan 14, 2019 · 8 comments

Comments

@abury
Copy link

abury commented Jan 14, 2019

Description

Hey Detox Team. 👋

We've been trying to get mocking working for our CI and are running into a lot of issues. We've spent an inordinate amount of time trying to find a way to get detox build working with the RN_SRC_EXT=e2e.js prefix, but we haven't had any luck. Only RN_SRC_EXT=e2e.js react-native start seems to work, however, we can't really do this in a CI setting.

I'm sure there is a simple step missing here. There are a number of Stack Overflow questions (with no or self-answers) on this topic. I think it would be really beneficial for there to be a simple example of how to use mocking alongside the recommended detox build command, or what to use instead.

Thanks! 👍

@LeoNatan
Copy link
Contributor

LeoNatan commented Jan 14, 2019

detox build is a convenience that calls a command provided by you. Why not use RN_SRC_EXT=e2e.js xcodebuild …?

@abury
Copy link
Author

abury commented Jan 15, 2019

Hey @LeoNatan

Thanks for the reply. We've tried using xcodebuild (after clearing ios/build) like so :
RN_SRC_EXT=e2e.js xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build

However, this hasn't worked. The only way I can get it to work is by calling
RN_SRC_EXT=e2e.js react-native start
And then manually calling detox test in a separate terminal window.

Is there a different way I should be calling xcodebuild, or perhaps detox build? We already have it set up in detox configuration in our package.json. Is there anything else we need to do?

Thanks! 👍

@LeoNatan
Copy link
Contributor

Which configuration are you running? Release should work.
If Debug, try perhaps starting the packager with that environment variable, and once the packager is running, build with xcodebuild.

@abury
Copy link
Author

abury commented Jan 15, 2019

@LeoNatan Ah, interesting. I believe it is debug, which could explain why it's only working when we start the packager manually. I'll see how we go with a release configuration.

@LeoNatan
Copy link
Contributor

It is always best to test with release configuration as it’s the closest to what users get.

You can also try exporting the env var, which May also help for debug.

@abury
Copy link
Author

abury commented Jan 16, 2019

@LeoNatan That was it! Turns out it needed we needed to be building it as a release configuration. Thanks so much for helping us through that.
It might be worth including in the Advanced Stubbing documentation that it must run on a release configuration to work. I'm more than happy to write that up if you feel it would help 👍

@abury abury closed this as completed Jan 17, 2019
@LeoNatan
Copy link
Contributor

You closed the issue, but I had a follow up question. If you export the env var, does it work for debug?
If so, that might be all that is needed to change in the docs.

@abury
Copy link
Author

abury commented Jan 18, 2019

Hey @LeoNatan. Sorry, I didn't hear back and didn't want to leave tickets open.
I didn't end up needing to try that as we just went with the release configuration. I'm not on this project for another few days but I'll give it a go when I get a chance.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants