How can I fix Detox Package subpath './build/cli/args' is not defined by "exports"

Viewed 1164

I am setting up detox for react native project and I have been working on the configs and when i sis the detox build --configuration android the build succeeded but when I am trying to run the detox test --configuration android I will end up getting following error detox[13452] ERROR: [cli.js] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './build/cli/args' is not defined by "exports" in /Users/Desktop/vahingonsattuessa/node_modules/jest-cli/package.json

My .detoxrc.json file is looking as follows:

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "apps": {
    "android": {
      "type": "android.apk",
      "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
      "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .."
    }
  },
  "devices": {
    "simulator": {
      "type": "ios.simulator",
      "device": {
        "type": "iPhone 12"
      }
    },
    "emulator": {
      "type": "android.emulator",
      "device": {
        "avdName": "Pixel_3a_API_30_x86"
      }
    }
  },
  "configurations": {
    "ios": {
      "device": "simulator",
      "app": "ios"
    },
    "android": {
      "device": "emulator",
      "app": "android"
    }
  }
}
1 Answers

You have a typo in your template declaration.

Change:

const referenceTemplate = path.resolve(`.src/templates/reference.js`)

To:

const referenceTemplate = path.resolve(`./src/templates/reference.js`)

In addition, your localizedSlug function seems to receive some wrong parameters. It seems to receive isPage as false, setting the URL to /blog, so check your query values.

Related