我正在使用detox
进行我的本机应用程序的端到端测试。当我尝试运行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.
答案 0 :(得分:1)
您应该使用&&
在npm脚本的任何平台和任何shell上运行多个命令。您可能希望它无法在Powershell上运行,但实际上可以。
[npm]的&&语义不完全相同(它执行 第二个命令,无论第一个命令是否成功),但它确实 可以将一行中的多个命令串在一起。
https://github.com/npm/npm/issues/4040#issuecomment-209034612