3

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?

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Alok
  • 184
  • 2
  • 18

2 Answers2

3

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

Pritish Vaidya
  • 21,561
  • 3
  • 58
  • 76
  • 2
    thanks it worked for me. I have to put config.json and spec files in same folder. – Alok Apr 12 '18 at 06:18
0

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
    ]
}
Vladislav Zaynchkovsky
  • 2,461
  • 2
  • 14
  • 22