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

assembleRelease isn't using metro exts replacements (mocks) #1557

Closed
Grohden opened this issue Jul 25, 2019 · 3 comments
Closed

assembleRelease isn't using metro exts replacements (mocks) #1557

Grohden opened this issue Jul 25, 2019 · 3 comments

Comments

@Grohden
Copy link

Grohden commented Jul 25, 2019

I'm trying really hard to make my tests run on the release version of my apk, but the assembleRelease task seems to be ignoring any exts I've added to metro.config.js, even through the sourceExts get is called at some point, it is being ignored, here's my conf:

const { sourceExts } = require('metro-config/src/defaults/defaults')

module.exports = {
    resolver: {
        get sourceExts() {
            const exts = process.env.RN_SRC_EXT
                ? process.env.RN_SRC_EXT.split(',').concat(sourceExts)
                : sourceExts

            console.log('[METRO] ',exts) // this is called on assembleRelease too

            return exts
        }
    },
    transformer: {
        getTransformOptions: async () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: false
            }
        })
    }
}

And here is my build definition

"android.device.debug": {
  "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
  "build": "pushd android && (./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release) && popd",
  "type": "android.attached",
  "name": "405cba2f"
}

assembleDebug works fine, and uses the exts defined by my env vars, but assembleRelease ignore them.

I know this is not a direct detox issue, but at the advanced mock docs there's a example pointing to use the assembleRelease without any warning, it would be nice to have some note on this issue (also, there are a lot of issues on stackoverflow and here not answered/solved about it)

Note: the reason why I'm trying to use the release version is cuz the debug version is slow on tests (typing is really slow, i suspect that it's cuz there's the RN ws looking for the metro server and making the event loop occupied every X seconds during the tests)

@support
Copy link

support bot commented Jul 25, 2019

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

Feel free to post your Stack Overflow question here for more visility. We'll take a look at it.

For more information on bots in this reporsitory, read this discussion.

@support support bot closed this as completed Jul 25, 2019
@Grohden Grohden changed the title assembleDebug isn't using metro exts replacements (mocks) assembleRelease isn't using metro exts replacements (mocks) Jul 25, 2019
@Grohden

This comment has been minimized.

@LeoNatan
Copy link
Contributor

LeoNatan commented Jul 28, 2019

It actually the bot did its job as expected. This is a usage question and we are asking that those be posted on Stack Overflow. Instead of posting meme spam, ask your question there and link it here.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants