Search code examples
react-nativejestjsdetox

Ran all test suites matching /e2e/i with tests matching "^((?!:ios:).)*$"


I am doing Detox testing and matching takes default as ios and I want to test in android, I am not able to change it to android. help me


Solution

  • Detox isn't running an iOS test. It only looks like that because of the negative lookahead in the regex.

    ```--testNamePattern='^((?!:ios:).)*$'`

    It's a negative lookahead, which means that for the expression to match, the part within (?!...) must not match

    update to comment

    Currently there is an issue in react-native:0.57.8 that is causing the the following error:

    Error: Couldn't find preset "module:metro-react-native-babel-preset"

    There is currently a workaround that can be found here https://github.com/facebook/react-native/issues/21241#issuecomment-431464191

    Step 1

    Create babel.config.js with the following content (basically equivalent to stock .babelrc)

    module.exports = function (api) {
      api.cache(true)
    
      return {
        presets: ['module:metro-react-native-babel-preset']
      }
    }
    

    Step 2

    Remove .babelrc

    Step 3

    Run yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core

    Personally I haven't needed to do step 3.