首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何让排毒测试仅在IOS上运行&禁用Android运行

如何让排毒测试仅在IOS上运行&禁用Android运行
EN

Stack Overflow用户
提问于 2018-12-17 21:05:03
回答 1查看 1K关注 0票数 1

我使用Detox为iOS创建了几个UI测试。最初,iOS测试运行得很好。注意--目前还没有Android测试

代码语言:javascript
复制
Config.json
{
    "setupTestFrameworkScriptFile": "./init.js",
    "testEnvironment": "node"
}

package.json代码片段:

代码语言:javascript
复制
"detox": {
"configurations": {
  "ios.sim.debug": {
    "binaryPath": "/Users/laxmisomni/Documents/Projects/mambo/ios/build/Build/Products/Debug-iphonesimulator/mambo.app",
    "build": "xcodebuild -workspace ios/appName.xcworkspace -scheme appName -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
    "type": "ios.simulator",
    "name": "iPhone 7"
  }
},
"test-runner": "jest",
"specs": "e2e"
},

错误:

代码语言:javascript
复制
Ran all test suites matching /e2e/i with tests matching "^((?!:android:).)*$".
child_process.js:651
    throw err;
    ^

Error: Command failed: node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'
    at checkExecSyncError (child_process.js:611:11)

Other dependencies in Package.json:
    "babel-eslint": "^8.2.3",
    "babel-jest": "23.0.1",
    "babel-preset-react-native": "4.0.0",
    "babel-register": "^6.26.0",

有没有办法禁止test runner尝试运行不存在的Android测试?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-18 03:55:39

排毒不是在做安卓测试。它看起来像是因为正则表达式中的negative lookahead

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

下面是我运行的一个成功的iOS测试的输出。

代码语言:javascript
复制
detox test
node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 --testNamePattern='^((?!:android:).)*$'

 server listening on localhost:55356...

 : Searching for device matching iPhone 7...

 : Uninstalling com.testapp.test...

 : com.testapp.test uninstalled
 : Installing /Users/work/Documents/test/ios/build/Build/Products/Debug-iphonesimulator/test.app...
 : /Users/work/Documents/test/ios/build/Build/Products/Debug-iphonesimulator/test.app installed
 : Terminating  com.testapp.test...
 : com.testapp.test terminated
 : Launching  com.testapp.test...
7: com.testapp.test launched. The stdout and stderr logs were recreated, you can watch them with:
        tail -F /Users/work/Library/Developer/CoreSimulator/Devices/AF406169-5CF3-4480-9D00-8F934C420043/data/tmp/detox.last_launch_app_log.{out,err}
 PASS  e2e/firstTest.spec.js (10.504s)
  Example
    ✓ should have Home tab (1283ms)
    ✓ should show detail screen after tap (1872ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        11.153s, estimated 12s
Ran all test suites matching /e2e/i with tests matching "^((?!:android:).)*$".

关于您的测试失败,如果没有看到日志的完整输出,我们无法帮助您。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53815864

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档