如何为 detox e2e 测试提供自定义测试文件路径

how to give custom test files path for detox e2e testing

我们正在使用 Detox 框架进行 IOS 端到端测试。 Detox 默认创建 e2e 文件夹,运行 所有测试文件都在其下创建。

有什么方法可以在其他文件夹上创建测试文件并配置该路径和 运行 它吗?

是的,你可以设置测试的路径

由于只支持MochaJest,因此如API

中所述

在你的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"
    }

其中 config.json 是 this

笑话示例:

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

config.json 例子:

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