Alok
Alok

Reputation: 184

how to give custom test files path for detox e2e testing

We are using Detox framework for IOS e2e testing. Detox by default created e2e folder and run all test files created under it.

Is there any way I can create the test files on some other folder and configure that path and run it?

Upvotes: 3

Views: 2735

Answers (2)

Vladislav Zaynchkovsky
Vladislav Zaynchkovsky

Reputation: 3319

Jest example:

"detox": {
    "test-runner": "jest",
    "runner-config": "e2e/config.json" // default
    "configurations": {
      ...
    }
}

config.json example:

{
    ...
    "roots": ["../src/..../e2e"],
    "testMatch": [  
      "**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)" // default
    ]
}

Upvotes: 0

Pritish Vaidya
Pritish Vaidya

Reputation: 22209

Yes, you can set the path of the tests

As Mocha and Jest are only supported, therefore as mentioned in the API

In your package.json

// For Mocha

"detox": {
      ...
      "test-runner": "mocha"
      "runner-config": "path/to/mocha.opts"
      "specs": "path/to/tests/root"
    }

// For Jest

"detox": {
      ...
      "test-runner": "jest"
      "runner-config": "path/to/config.json"
    }

where config.json is this

Upvotes: 3

Related Questions