【发布时间】:2020-05-10 05:18:24
【问题描述】:
我正在使用 detox 对我的 react-native 应用程序进行端到端测试。当我尝试运行yarn detox build -c android.emu.release 时,它不能很好地运行脚本cd android ; ./gradlew assembleRelease app:assembleAndroidTest -DtestBuildType=release ; cd -。该脚本由detox init自动生成。
这是我的package.json 文件:
{
"detox": {
/*...*/
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android ./gradlew assembleRelease app:assembleAndroidTest -DtestBuildType=release ; cd -", //<<<<<<<<<<<
"type": "android.emulator",
"device": {
"avdName": "NexusOneAPI29"
}
}
/*...*/
},
/*...*/
}
例如,我正在努力运行yarn detox build -c android.emu.release。如果
我需要使用哪个符号/字符来连接命令而不是 ; 排毒?
我认为主要错误是:The system cannot find the path specified. 从下面提取。
$ yarn detox-build
yarn run v1.21.1
detox[7600] INFO: [build.js] cd android ; gradlew assembleRelease app:assembleAndroidTest -DtestBuildType=release ; cd -
The system cannot find the path specified.
detox[7600] ERROR: [cli.js] Error: Command failed: cd android ; gradlew assembleRelease app:assembleAndroidTest -DtestBuildType=releas
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
【问题讨论】:
-
你想在里面加入 shell 脚本吗?
-
我知道您的目标是 Android,但是您在什么环境中运行 npm 脚本?您是否尝试过使用
&&而不是;? -
我确实尝试过
&&,但它在 Windows 上的 Powershell 上不起作用:'( -
@AlexandreLage - 是的,你是对的,我忘记了我之前在 Powershell 中的created an alias for the which command。你需要运行
get-command cmd.exe。但是,它现在不相关,因为您的问题与原始问题有很大不同。
标签: javascript android powershell react-native package.json