当通过 git 预提交挂钩 运行 TestCafe 测试文件时,我如何 return 布尔值是否有任何测试失败?

When running a TestCafe test file via a git pre-commit hook, how can I return a boolean value whether any test has failed?

现在我只是用 testcafe chrome general-tests.js 触发对 运行 的测试。但无论是否有任何测试失败,我都需要取回一个布尔值,以便我可以创建一个条件。如果检测到失败,则 exit 1 将停止提交。

是否有可用于此的 flag 的 testcafe 命令?或者有更好的方法吗?

testcafe returns 出现故障时的退出代码,因此您所要求的应该开箱即用。

我能够为以下操作取回退出代码 1:

  • 测试失败
  • 使用无法找到的浏览器
  • 使用无法找到的测试